loader.contentLoaderInfo.applicationDomain.getDefinition

by ile forked from Security.allowDomain (diff: 18)
♥0 | Line 27 | Modified 2011-11-04 07:37:16 | MIT License
play

ActionScript3 source code

/**
 * Copyright ile ( http://wonderfl.net/user/ile )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/t4yG
 */

// forked from ile's Loader Security.allowDomain ONLY
package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.system.Security;
    import flash.display.MovieClip;

    public class Main extends Sprite {
        private var swfLoader:Loader;
        private var url:String = "http://ile.jp/wp-content/uploads/2011/11/panel.swf";
        private var urlReq:URLRequest;
        private var panelMSclass:Class;
        private var panelMS:MovieClip = new MovieClip;
            
        public function Main() {
            Security.allowDomain("*");
            swfLoader = new Loader();
            urlReq = new URLRequest(url);
            swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, drawParts);
            swfLoader.load(urlReq);
        }
        private function drawParts(event:Event):void{
            //panel.swf>ライブラリ>リンゲージ>panelMS_mc
            panelMSclass = swfLoader.contentLoaderInfo.applicationDomain.getDefinition("panelMS_mc") as Class;
            panelMS = new panelMSclass();
            addChild(panelMS);
        }
    }
}