Avoiding VerifyError 9re forked:0favorite:0lines:26license : MIT License modified : 2010-07-26 16:21:29 Embed Tweet package { import flash.events.Event; import flash.net.URLLoaderDataFormat; import flash.net.URLLoader; import flash.system.ApplicationDomain; import flash.system.LoaderContext; import flash.net.URLRequest; import flash.display.Loader; import flash.display.Sprite; import mx.core.FontAsset; public class FlashTest extends Sprite { public function FlashTest() { // link the missing class into the parent swf var c:Class = mx.core.FontAsset; var req:URLRequest = new URLRequest('http://teionclub.com/test/xml/main.swf'); var lc:LoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain)); var ldr:URLLoader = new URLLoader; ldr.dataFormat = URLLoaderDataFormat.BINARY; ldr.addEventListener(Event.COMPLETE, function ():void { var loader:Loader = new Loader; // load the swf binary into the current application domain loader.loadBytes(ldr.data, lc); addChild(loader); }); ldr.load(req); // If you load the swf directly, you'll get a verify error. /* var ldr2:Loader = new Loader; ldr2.load(req, new LoaderContext(true, ApplicationDomain.currentDomain)); addChild(ldr2); */ } } } Code Fullscreen Preview Fullscreen FontAsset LoaderContext data URLRequest Event.COMPLETE addEventListener addChild Sprite