jeudi 20 avril 2017

SWFLoader Working in Air Project but not Web Project

I have been developing a Web type Flex project in Flash builder. In this project I have been trying to load a swf file using the SWFLoader. I have had trouble getting the debugger working, so I have instead created an identical Air project that I can run and debug with (I keep it up to date with a script). I have successfully loaded the swf file in my Air project with no trouble. But, when I went to test this in my Web project, the SWFLoader does not seem to work, I just get a blank area where my SWFLoader element should display the loaded swf file.

private function get_swf_file_binary_amf(event:ResultEvent):void {
            Alert.show("SWF Returned");
            var decoder:Base64Decoder=new Base64Decoder();
            decoder.decode(event.result);
            var swf_bytes:ByteArray=decoder.toByteArray();

            var context:LoaderContext=new LoaderContext();
            context.allowLoadBytesCodeExecution=true;
            context.parameters = {myval: "test_string"};

            swf_loaded_file.loaderContext = context;
            swf_loaded_file.addEventListener(Event.COMPLETE, loadComplete);
            swf_loaded_file.load(swf_bytes);
        }

private function loadComplete(completeEvent:Event):void{
    trace("load Complete")
}

Above is the code that works in my Adobe Air project. I am receiving the binary data of my swf file and converting it into a ByteArray, not using the URLLoader like so many example suggest. Could this be the cause of my problems when I try to run this in my Web project?

Aucun commentaire:

Enregistrer un commentaire