Avoiding VerifyError
♥0 |
Line 26 |
Modified 2010-07-26 16:21:29 |
MIT License
archived:2017-03-09 14:28:19
ActionScript3 source code
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/omco
*/
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);
*/
}
}
}