Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with SWF library #697

Open
slabgames opened this issue Jun 14, 2021 · 4 comments
Open

Incompatibility with SWF library #697

slabgames opened this issue Jun 14, 2021 · 4 comments

Comments

@slabgames
Copy link

Haxe 4.2.2
NME github source
SWF 3.0.2

I got this error message when building my game:

bin/windows/haxe/nme/AssetData.hx:20: characters 62-83 : Type not found : format.swf.SWFLibrary
@slabgames
Copy link
Author

How do I change this line of code?

Assets.addLibraryFactory( SWF, function(id) return new format.swf.SWFLibrary(id) );

to

Assets.addLibraryFactory( SWF, function(id) return new swf.SWFLibrary(id) );

@hughsando
Copy link
Member

You could create a file format/swf/SWFLibrary.hx with a typedef in it, like:

package format.swf;
typedef SWFLibrary = swf.SWFLibrary;

but I'm not sure what the "correct" answer is.
Another way would be to put a conditional in the AssetData class to use "swf.SWFLibrary" if swf is defined - which it will be in the case of "-lib swf". This might be better if it it valid to have two different use cases.

@slabgames
Copy link
Author

Thanks, but it leads me to other errors:

c:\haxetoolkit\haxe\lib\swf/3,0,2/src/swf/SWFLibrary.hx:13: characters 8-33 : Type not found : openfl.utils.AssetLibrary
c:\haxetoolkit\haxe\lib\swf/3,0,2/src/swf/SWFLibrary.hx:14: characters 8-30 : Type not found : openfl.utils.AssetType
c:\haxetoolkit\haxe\lib\swf/3,0,2/src/swf/SWFLibrary.hx:16: characters 8-27 : Type not found : openfl.utils.Future
c:\haxetoolkit\haxe\lib\swf/3,0,2/src/swf/SWFLibrary.hx:17: characters 8-28 : Type not found : openfl.utils.Promise
c:\haxetoolkit\haxe\lib\swf/3,0,2/src/swf/SWFLibrary.hx:27: characters 33-45 : Type not found : AssetLibrary
bin/windows/haxe/nme/AssetData.hx:13: lines 13-25 : ... Defined in this class

@hughsando
Copy link
Member

Yes, looks like that library is too closely tied to openfl. You could try using the format.swf library, but I suspect the api will be different. Other options would be porting the swf library to nme, or wrapping swf, format.swf or gm2d.swf in a "loader class".
It might be that it is mainly the loading that is different, so once you have used the particular method to load the library, the rest is pretty similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants