Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

loading remote swf through php in air

$
0
0

Hello i use this code to import a remote swf through a remote php file

 

this works with flash player but not with Air

 

 

 

 

this is code:

 

 


var scriptName  :String = "http://www.xxx.com/readSWF.php";  
var codeErr     :int;
var requestPHP  :URLRequest;
var loader      :URLLoader;
var varsToPHP   :URLVariables;
var varsFromPHP :URLVariables;
var loaderSWF   :Loader;

requestPHP        = new URLRequest(scriptName);
requestPHP.method = URLRequestMethod.POST;
varsToPHP         = new URLVariables();
loader            = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;

 


loader.addEventListener(Event.COMPLETE, completePHP);

 

 

 


btn_Read.addEventListener(MouseEvent.CLICK, readSWF);

 

function readSWF(evento:MouseEvent):void

   
    varsToPHP.fileName = "test.swf";
 
    requestPHP.data = varsToPHP;
  
    loader.load(requestPHP);
}

 

function completePHP(evento:Event):void
{
  

      
    var bytesFromPHP:ByteArray = new ByteArray();
   
    bytesFromPHP = loader.data;

  

   
    loaderSWF = new Loader ();
    loaderSWF.contentLoaderInfo.addEventListener(Event.COMPLETE, caricatoSWF);

  
    loaderSWF.loadBytes(bytesFromPHP);
}

 

function caricatoSWF(evento:Event):void
{
    var objSWF:MovieClip = evento.target.content;

    
    objSWF.x = 1;
    objSWF.y = 737;
    addChild(objSWF);

 

}

 

 

 

Can you help me to modify it to make it work with air too? Thanks


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>