Load external SWF loader content not accessible

131 Views Asked by At

Actually i have a SWF that is loaded by another SWF. This SWF that is loaded, itself load another SWF.

This may be weird, but it's in a context of an online game that let you develop SWF as plugins.

So, we have SWFA(the video game) ---> SWFB ----> SWFC

When i try to load the external SWFC, the COMPLETE event fire, but i am only able to add it to the stage by adding directly the Loader, because the loader doesn't have any content property.

    public function load(){
        loader = new Loader();
        loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
        loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
        loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIoError);
        loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onIoError);
        loader.contentLoaderInfo.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
        applicationContext = new LoaderContext(true, ApplicationDomain.currentDomain); 
        loader.load(getRequest(),applicationContext);
    }


    private function getRequest():URLRequest {
        Security.allowDomain("https://mock.com");
        Security.loadPolicyFile("https://mock.com/crossdomain.xml");
        var req:URLRequest = new URLRequest("https://mock.com/mock.swf");
        req.method = URLRequestMethod.POST;
        req.data = new URLVariables("name=kk");

        var encoder:Base64Encoder = new Base64Encoder();       
        encoder.encode("user:pass");
        var credsHeader:URLRequestHeader = new 
        URLRequestHeader("Authorization", "Basic " + encoder.toString());
        req.requestHeaders.push(credsHeader);
        return req;
    }

Here is the onComplete function

    public function onComplete (e:Event):void{;
        this.addChild(e.target.content); // this is null
        this.addChild(e.currentTarget.content); //  null too
    }

So, when i run my SWF from my local computer, everything goes well, e.target.content contain my external SWF. But when i run the same within the SWF Loader inside the online game, i can't find any content property. Plus, childAllowParent property of LoaderInfo is always false.

Does someone have an idea of what's going on?

Thanks

0

There are 0 best solutions below