8 March 2013
private var externalSwfUrl:String= "http://www.xyz.com/ExternalSwf.swf";
private var urlRequest:URLRequest = new URLRequest(externalSwfUrl);
During command line packaging using AIR Developer Tool(ADT), the developer needs to specify the text file just like an asset along with the set of SWF’s mentioned in the text file. A sample ADT command for using this feature is:
~/bin/adt -package -target ipa-app-store -provisioning-profile -storetype pkcs12 -keystore -storepass ResultantIPA.ipa SampleMainSwf-app.xml SampleMainSwf.swf assets/SampleSWFInfoFile.txt assets/Level1.swf assets/Level2.swf assets/Level3/asset/Level3.swf
During IPA packaging, ADT extracts the ABC code from all child SWFs, adds it to the final executable and generates stripped SWFs in the “externalStrippedSwfs” folder created in the current working directory. The directory structure within the “externalStrippedSwfs” folder remains the same as specified within the text file. The generated stripped SWF’s should then be externally hosted on a web server of developer’s choice.
NOTE: The “externalStrippedSwfs” folder is not generated in the currently available release of Flash Builder 4.7/ Flash CS6. To enable generation of Stripped SWFs for external hosting, command line ADT packaging should be used.
A sample actionscript code which loads a secondary SWF from an external server is described below:
public class SampleMainSwf extends Sprite
private var externalLoader:Loader;
private var url:String= "http://www.xyz.com/Level1.swf";
private var urlRequest:URLRequest = new URLRequest(url);
private var ldrContext:LoaderContext;
public function SampleMainSwf()
externalLoader = new Loader();
trace("Error ID : "+e.errorID+"\nError Message : "+e.message);
private function completeHandler(e:Event):void
private function errorHandler(e:IOErrorEvent):void
trace("In IO ErrorEvent Handler");
Points to note
- Conflicting symbols (classes and global functions) in all the packaged SWFs must be avoided as this might result into undesired behaviour.
- The stripped SWFs generated using this feature are different from pure asset SWFs. It must be noted that while pure asset SWFs are valid SWFs, the stripped SWFs are invalid SWFs.
- The SWF version of the ROOT.SWF must be greater than or equal to twenty (>= 20), to use this feature. If the SWF version is set to less than twenty (<20), the stripped SWFs won’t be generated in the “externalStrippedSwfs” folder even if the SWF files have been specified in the text file.
- It is recommended that this feature should not be used as a means for updating and displaying content in a dynamic manner. The externally hosted SWFs should not be replaced by any other stripped SWFs except the ones generated during IPA packaging. Any change in the secondary SWF requires a corresponding updation of stripped SWFs on external server.
- All the SWFs specified in the text file should be passed during the ADT packaging as well.