I am developing an IOS app using Adobe AIR, Flash and ActionScript 3 and I have divided sections up into separate SWF files. I have successfully gotten the app to load external SWFs and execute their ActionScript using the following code:
var proloader:ProLoader = new ProLoader();
proloader.load(new URLRequest("file.swf"), new LoaderContext(false, ApplicationDomain.currentDomain, null));
addChild(proloader);
Now, I would like to add a reset button that allows the user to return to the start of the first SWF from any other SWF file to restart the app. Unfortunately, it seems that whenever I try to load a SWF that has previously been loaded, nothing happens. I have read that unloading and reloading SWFs is not permitted on IOS and the fact that you are limited to one ApplicationDomain on IOS makes things difficult. However, I am still thinking there must be some workaround. I'd be okay with not ever unloading the external SWFs if that is the only way, but I still can't figure out a way to return to a SWF that was previously loaded.
Does anyone know of a way to return to a SWF that was previously loaded in IOS with Adobe Air?
I was able to solve the problem of reloading SWF's w/o ABC (no code!), I explain it all on my blog (http://www.eqsim.com/blog/?p=400) but also simply give the code on StackOverflow: Load and reload external SWF in AIR for iOS wf-in-air-for-ios/22046009#22046009
Now Adobe has a solution for separating code from the SWF, and loading the SWF externally. However, we addressed it prior to AIR 3.5 by making a class for the code only, then loading the SWF and in the code class, setting a link to the loaded SWF. When we needed to update to 4.0, the SWF reloading, even pure SWF assets, was not working in all situations, so we plugged away to find the solution I reference above.
You could have a static class that functions as a cache.
The cache might look something like this that I made for a menu system:
package com.rs2014.managers{ import flash.display.MovieClip; import flash.utils.Dictionary; import flash.events.Event; import flash.events.EventDispatcher;
}