Copy link to clipboard
Copied
Adobe, can you please provide us with the code to load multiple swf files for ios. Please provide examples. The code below loads multiple swfs, but the swfs stall, so this does not seem to be a solution.
Code description: A flash file made up of 4 frames with forward and back buttons that navigate from frame to frame. The code loads three different swf files in frames 2, 3 and 4.
Frame 1:
var myLoader:Loader;
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
if(myLoader == null){myLoader = new Loader(); addChild(myLoader); }
else {myLoader.unload();}
Frame 2:
Frame 3:
Frame 4:
Copy link to clipboard
Copied
That's good to know, but how I should you aceess assets from the app if I am not exporting symbols' for Action Script (to avoid inclusion of ABC code)?
Copy link to clipboard
Copied
My team is attempting to unload SWFs and load them a second time on iOS. We're using the functionality Nimisha referred to in #24, i.e. the "stripped SWFs" pipeline.
I'm still receiving an error of "Reloading a SWF is not supported on this operating system" when I attempt to unload and reload the same SWF.
In fact, when I experiment with unloading a Loader used to load in such a stripped SWF, I find that it is staying in memory even after I null-out the only reference to it, and run both unload() and unloadAndStop() on it. I assume this is related to the iOS-specific functionality mentioned above.
Nimisha's last comment seemed to imply that the stripped-SWF pipeline would make this reloading functionality work. If that's the case, then is this a bug? I'd be happy to share the simple test project I've created.
Copy link to clipboard
Copied
Hi IQpierce0,
Please don't get confused between pure asset SWFs and stripped SWFs. Both are different and reloading for pure asset SWFs will work but will not work for stripped SWFs.
-Nimisha
Copy link to clipboard
Copied
Nimisha,
Thanks for the clarification that reloading does not currently work for stripped SWFs. My next questions are:
I noticed that in the latest AIR 3.7 SDK beta release notes, the first "Known Issue" is "3525750 - Reloading of a SWF which contains any ABC code throws an error 3764". Does that mean that this is acknowledged as a bug, and going to be fixed in the next version of AIR Mobile?
My team is working on an app that can loaded in thousands of remote SWFs (legacy content), and they need to have some ABC code on them. The set of content is well-defined, so we were planning to use the "stripping" pipeline.
However, this reloading limitation makes all of this useless. Being able to load remote SWF content is almost impossible if you're unable to reload those SWFs.
It would help to know exactly why this limitation exists - why is error #3764 being thrown? Why does it happen for stripped SWFs (which have no bytecode being downloaded) and not for graphical SWFs (which also have no bytecode being downloaded)?
Copy link to clipboard
Copied
This is not considered as a bug but a limitation.
>>It would help to know exactly why this limitation exists - why is error #3764 being thrown? Why does it happen for stripped SWFs (which have no bytecode being downloaded) and not for graphical SWFs (which also have no bytecode being downloaded)?
The SWFs which are converted to stripped SWFs have code initially which is compiled while the AOT packaging and when stripped SWF is loaded, it is loaded with the compiled code.
That is why reloading will not work with the stripped SWF as the SWF has to be loaded with the code which is the not the case with the pure asset SWFs.
Copy link to clipboard
Copied
I've just tried loading, unloading and then loading again same SWF with 2 library objects linked for AS3 export. It worked both on simulator and on device in debug mode. When I look inside swf it does contain AS3 code.
So is my swf a pure asset SWF? Or Intellij Idea 12 that I'm using does stripping automatically?
And then I've read your comment at http://forums.adobe.com/message/5217325#5217325 and run 'swfdump' utility on my .swf file. Looks like there's no ABC2 code, that's why app was able to load, unload and load again the same swf.
public dynamic class net.games.bg extends flash.display.MovieClip
{
native public function bg():*;
native public var one:flash.display.MovieClip;
native public var three:flash.display.MovieClip;
native public var two:flash.display.MovieClip;
}
public dynamic class net.games.z1 extends flash.display.MovieClip
{
native public function z1():*;
}
I can access objects as instances through root or as objects through getDefinition.
private var aLoader : Loader;
private function init():void
{
load1();
}
private function load1():void
{
aLoader = new Loader();
var url:URLRequest = new URLRequest("levels/expirementlevel1.swf");
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
aLoader.load(url, loaderContext); // load the SWF file
aLoader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, handleSWFLoadComplete1, false, 0, true);
}
private function handleSWFLoadComplete1(e:flash.events.Event):void {
var levelObjectsMC:flash.display.MovieClip = e.target.loader.content;
for (var i:uint = 0; i < levelObjectsMC.numChildren; i++){
trace ('\t|\t ' +i+'.\t name:' + levelObjectsMC.getChildAt(i).name + '\t type:' + typeof (levelObjectsMC.getChildAt(i))+ '\t' + levelObjectsMC.getChildAt(i).x);
}
var LibraryClass:Class = e.target.applicationDomain.getDefinition("net.games.z1") as Class;
var myLibraryObject:flash.display.MovieClip = new LibraryClass as flash.display.MovieClip;
trace(' load 1 ' + myLibraryObject);
aLoader.unload();
load2();
//addChild(levelObjectsMC);
}
private function load2():void
{
aLoader = new Loader();
var url:URLRequest = new URLRequest("levels/expirementlevel1.swf");
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
aLoader.load(url, loaderContext); // load the SWF file
aLoader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, handleSWFLoadComplete2, false, 0, true);
}
private function handleSWFLoadComplete2(e:flash.events.Event):void {
var levelObjectsMC:flash.display.MovieClip = e.target.loader.content;
for (var i:uint = 0; i < levelObjectsMC.numChildren; i++){
trace ('\t|\t ' +i+'.\t name:' + levelObjectsMC.getChildAt(i).name + '\t type:' + typeof (levelObjectsMC.getChildAt(i))+ '\t' + levelObjectsMC.getChildAt(i).x);
}
var LibraryClass:Class = e.target.applicationDomain.getDefinition("net.games.z1") as Class;
var myLibraryObject:flash.display.MovieClip = new LibraryClass as flash.display.MovieClip;
trace('load 2 x ' + myLibraryObject.x);
aLoader.unload();
}
Copy link to clipboard
Copied
In my mobile app I use new compiler ASC 2.0. And on iOS has bugs. If secondary SWF compile with ASC 2.0
1) In release build, loading never complete
2) Has 7-8 FPS,but if compile with mxmlc - 30FPS
Tested on Ipad2, iPad 4
Copy link to clipboard
Copied
Hi V.Zhelezny,
I can load a secondary SWF which is compiled with ASC 2.0. Can you please provide more details about your problem like which AIR SDK you're using? Also you can share a sample app(source code , SWFs, app-xml and all assets with which IPA can be packaged) with which I can reproduce the defect. Also don't forget to add the steps to reproduce.
Thanks,
Nimisha
Copy link to clipboard
Copied
Hi
AIR SDK 3.7 and secondary SWF has ABC code.
Try share small sample tomorrow
Copy link to clipboard
Copied