Created
April 12, 2013 10:27
-
-
Save matthua/5371100 to your computer and use it in GitHub Desktop.
Externally hosting secondary swf files (iOS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.display.Loader; | |
import flash.display.Sprite; | |
import flash.events.Event; | |
import flash.events.IOErrorEvent; | |
import flash.net.URLRequest; | |
import flash.system.ApplicationDomain; | |
import flash.system.LoaderContext; | |
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(); | |
externalLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler); | |
externalLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorHandler); | |
ldrContext=new LoaderContext(false,ApplicationDomain.currentDomain,null); | |
try | |
{ | |
externalLoader.load(urlRequest, ldrContext); | |
} | |
catch(e:Error) | |
{ | |
trace("Error ID : "+e.errorID+"\nError Message : "+e.message); | |
} | |
} | |
private function completeHandler(e:Event):void | |
{ | |
addChild(externalLoader); | |
} | |
private function errorHandler(e:IOErrorEvent):void | |
{ | |
trace("In IO ErrorEvent Handler"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://helpx.adobe.com/en/flash-player/release-note/fp_117_air_37_release_notes.html