Load External Swf Library

Hi, is there a way to load swf library in runtime for ios and android targets? For example: is it possible to download remote swf, save to local storage and later use as swf library or it must be registered at compile time ?

I’ve tried using Loader and looks like swf is loaded but once i add it into display list nothing shows up. It works fine with png image. Is that means there is no possibility to load external swfs for android and ios targets?

I’m coming from flash world and i remember there were restrictions on ios when it comes to the swf loading in runtime using air but there was possibility to load most trivial swfs…

Hi all, I have similar issue. I too am using Loader as in the following snippet. There are no errors while compiling and executing, however the output is just a black display.

	var loader = new Loader();
	loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadswf, false, 0, true);
	loader.load(URLRequest("assets/ABC.swf"));

and the callback function is

private function onLoadswf(e:Event):Void 
{
	trace(e.target.content);
	var _displayClip:DisplayObjectContainer = cast e.target.content;
	addChild(_displayClip);
}

And yes the callback function is not getting called.
In project. xml I have following entries

<source path="src" />
<haxelib name="openfl" />
    <haxelib name="swf" />
<haxelib name="actuate" />

<!-- assets -->
<assets path="assets/" include="*.swf" />

One more important thing. The swf which I am trying to load is a generated swf of another project made in haxe/openfl, which works fine on it’s own.

Flash Player supports loading of SWF files, but OpenFL does not include an ActionScript interpreter. This means you cannot load a SWF on mobile, as if it were Flash Player (though you could do this with OpenFL and AIR)

However, you can use the “SWF” library to load assets, even at runtime. SWFLite has additional benefits, but the regular “SWF” type can be used manually:

‘var swf = new format.SWF (bytes);"’

Hey majesty thanks for the reply. So, with this too I can load swf contents, right? like we do with methods given here - http://www.openfl.org/learn/tutorials/using-swf-assets/

Here’s what it looks like:

https://github.com/openfl/swf/blob/master/format/SWF.hx

swf.createMovieClip (“MySymbolClass”); should give you something out of your downloaded SWF on native

Hey thanks majesty, for now I am using swf assets itself (as m short of time). However, surely will come back to this. thanks

For the record, the SWF format is now at https://github.com/openfl/openfl/blob/develop/src/format/SWF.hx