Flex尝试将加载的SWF替换为另一个加载的SWF,即使在首先卸载之后也会抛出非法覆盖

时间:2013-08-27 12:42:35

标签: actionscript-3 flex

如果我一个接一个地加载两个swfs,它会抛出一个错误非法覆盖。第一个swf使用SDK 4.7编译,第二个使用SDK 3.5编译。我试图单独加载它们,它们都有效。但顺序而言,在删除第一个之后,它会抛出错误#1053:在mx.managers.SystemManagerProxy中非法覆盖activate。

public function App()
    {
        _fs.open(_installerDownloader,FileMode.READ);
        var ba:ByteArray = new ByteArray();
        _fs.readBytes(ba);
        _fs.close();

        context = new LoaderContext();
        context.allowCodeImport = true;
        context.applicationDomain = ApplicationDomain.currentDomain;

        loader = new Loader();
        this.addChild(loader); //required so that the loaded SWF has access to the 'stage' property
        loader.loadBytes(ba,context); //run the loaded SWF within the security sandbox of this application
        stage.align = StageAlign.TOP_LEFT;
        stage.scaleMode = StageScaleMode.NO_SCALE;
    }

    public function launchApplication():void
    {   
        loader.addEventListener(Event.REMOVED_FROM_STAGE,launchMC);
        loader.unloadAndStop(true);
        this.removeChild(loader);
    }

    public function launchMC(e:Event):void
    {
        _fs.open(_installer,FileMode.READ);
        var ba:ByteArray = new ByteArray();
        _fs.readBytes(ba);
        _fs.close();            

        context = new LoaderContext();
        context.allowCodeImport = true;
        context.applicationDomain = ApplicationDomain.currentDomain;
        loader = new Loader();
        this.addChild(loader); //required so that the loaded SWF has access to the 'stage' property
        loader.loadBytes(ba,context); //run the loaded SWF within the security sandbox of this application
        stage.align = StageAlign.TOP_LEFT;
        stage.scaleMode = StageScaleMode.NO_SCALE;
    }

谢谢, 大卫

0 个答案:

没有答案