简体   繁体   中英

AS3 loading B.swf with A.swf loader

Problem is, B.swf is main app, since it is big I am using separate A.swf for loading B.swf and then just adding to stage. But in that case B.swf don't works properly (something works but some functions don't work) it is defenitly about what is main stage in that case. When i load directly B.swf it works perfectly, so any ideas how to load B.swf with A.swf and than to "change" main timeline/stage to point to B.swf so B can be full functional?

have you tried to load the B.swf into currentDomain like so:

var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
yourLoader.load(new URLRequest("B.swf"), context);  

of course remembering to add all events:) like complete and ioerror,

I don't know if this can help you, but it's a Live Update System what I've done with the preloader of FlashDevelop :

public function Preloader() 
{
        var mLoader:Loader = new Loader();  
        var mRequest:URLRequest = new URLRequest("ABSOLUTE URL");
        mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
        mLoader.load(mRequest);

        function onCompleteHandler(loadEvent:Event):void 
        {
            addChild(loadEvent.currentTarget.content);
        }

        if (stage) {
            stage.scaleMode = StageScaleMode.NO_SCALE;
        }

        addEventListener(Event.ENTER_FRAME, checkFrame);
        loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
        loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);

        // TODO show loader
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM