I wish to load an external swf compiled with swfmill, at run time. In other words, loading it asynchronously (not compiled together with the file). This swf contains 2 assets: file1.png and file2.png.
It's mostly working, except for this problem: how to attach the resources in the file? Normally I would use attach()…
var _urlLoader = new URLLoader();
var _urlRequest = new URLRequest("libgfx.swf");
_urlLoader.load(_urlRequest);
_urlLoader.addEventListener(Event.COMPLETE, onComplete);
public function onComplete(e:Event) {
trace("Received shared libgfx.swf. Length: " + _urlLoader.data.length); // displaying the size correctly
var displayObjectLoader:Loader = new Loader();
displayObjectLoader.load(_urlRequest);
var displayObject:DisplayObject = addChild(displayObjectLoader);
// How would you attach file1.png or file2.png?
// …?
}
Any help appreciated :)
Use the following code to load it:
Hope this helps.
Cheers
Tamas Gronas