I have many swf files and I want to load some of them by Assets.loadLibrary().
Before of that I load .bundles dynamically but now I don’t know how it works. I could load them including the library path into project.xml but is tedious and I don’t want to have to do it every time I add a new swf file.
Are there any way to load swf without into project.xml?
This should be possible if you run
openfl process first:
openfl process test.swf
This should generate a “test.bundle” directory.
We are currently working on a newer SWF conversion format that outputs to a ZIP file instead.
1. Including a .bundle in your assets directory
If you drop a *.bundle directory in your assets directory, it should be possible to use
Assets.loadLibrary with the path to the bundle, like this:
var clip = Assets.getMovieClip("assets/test.bundle:MyMovieClip");
2. Including a .bundle separately
You should be able to load a *.bundle from an arbitrary location at runtime using one of two methods
var loader = new Loader();
Similar to how Flash instantiates content when using a
Loader, this will instantiate the main timeline of the target library once it is loaded. I believe we might also register it with
Assets so that you can reference other resources
var clip = Assets.getMovieClip("path/to/test.bundle:MyMovieClip");
The other method is to use
openfl.utils.AssetLibrary and to load it that way. Once loaded you can register with
openfl.utils.Assets if you like for convenience.
var clip = library.getMovieClip("MyMovieClip");
var clip = Assets.getMovieClip("test:MyMovieClip");
Thanks for quick asnwer!
I have a project and I load .bundle perfectly 1 week ago but I try to do this way because I upload openfl and lime to the last version and suddendly when I load .bundles in runtime the console returns this warning “[lime.utils.AssetLibrary] WARNING: Could not find library type: openfl._internal.swf.SWFLiteLibrary” and nothing is drawn
I try running
openfl process over the SWFs again but the warning persists. Do you know whats is wrong?
Is this the development version from GIT or the latest release on Haxelib?
There has been a fair amount of dust lately on GIT but I think it is smoothing out (but you will need to
openfl rebuild tools after pulling the latest to build the changes for SWF libraries)
I’ve fixed it… removing the Chrome cache The browser was getting old .bundle files!!
Sorry and thanks for all!!