I had this problem for a while, but this time I would really like to solve it. Basically, if you embed a SWF library (bundle) - it wouldn’t be accessible anymore.
The SWF libraries are being generated via the
openfl process mySWF.swf command. That would by default give me a
mySWF.bundle directory with my assets.
projects.xml file I could then include the library:
<assets path="assets/layout.bundle" rename="layout" embed="false" />
In my project, I would have to first load the library and then be able to use it. It’s wildly convenient to use it this way because I get access to generated classes that I could then use with all the auto-completion.
The problem starts when I try to set the tag
embed=true. At this point the generated bundle becomes a part of the EXE file, and you can see the assets in the asset-list:
Assets.list().toString() would give you a whole list of assets.
But now there’s no known way to access any of the assets. Trying to use any of set methods from the
Assets class would tell me that the asset does not exist.
An interesting side note is that SWF assets aren’t listed within any
trace( "all", Assets.list().toString() ); // [symbols/1.png,symbols/9.png,swflite.bin,symbols/6.png,symbols/15.png,fonts/NotoSansJP-Regular.otf] trace( "bin", Assets.list(AssetType.BINARY).toString() ); // [fonts/NotoSansJP-Regular.otf] trace( "font", Assets.list(AssetType.FONT).toString() ); // [fonts/NotoSansJP-Regular.otf] trace( "img", Assets.list(AssetType.IMAGE).toString() ); // trace( "mcs", Assets.list(AssetType.MOVIE_CLIP).toString() ); // trace( "music", Assets.list(AssetType.MUSIC).toString() ); // trace( "sound", Assets.list(AssetType.SOUND).toString() ); // trace( "text", Assets.list(AssetType.TEXT).toString() ); // trace( "template", Assets.list(AssetType.TEMPLATE).toString() ); //
FYI, the font in this example is added via
<assets path="assets/fonts" rename="fonts" embed="true"/> and is not a part of the main library.
Is there a way use generated bundles without referring to the
generated=true tag and loading SWFs? The reason I want to use bundles is because it’s really nice for auto-completion, especially with nested assets and using SWFs would often bug out IDEs and make them stop auto-completion throughout the whole project.