geek space web solutions

Send array from Flash / As3 to a PHP file

Tuesday, 20 July 2010 12:16
The development of Flash requires regular use of external files as php, asp or of the coldfusion to perform functions such as sending e-mail or inserting data into a database ...

That is my method for passing arrays to a php file named flash_pele_mele.php.
I still said that this type of transfer variable is of course possible only for variables of type String, Number and int ...


Code AS3 side (look especially variable urlv) :
var postForm:URLRequest = new URLRequest("flash_pele_mele.php");
var urlv:URLVariables=new URLVariables();

var arraySourcesImagesLoaded:Array = new Array();

// We fill the array
(...)

urlv["urlSrcImg[]"] = arraySourcesImagesLoaded;

postForm.data = urlv;
postForm.method = URLRequestMethod.POST;

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, processComplete);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, processError);
loader.addEventListener(IOErrorEvent.IO_ERROR, processError);
loader.load(postForm);


function processComplete(e:Event):void{
(...)

}

function processError(e:*):void{
(...)

}



Code PHP side :
for($k=0; $k<sizeof($_POST["urlSrcImg"]); $k++) {

$arraySrcImg[$k] = imagecreatefromjpeg($_POST["urlSrcImg"][$k]);

}
 

Comments  

 
# Guest 2010-11-17 14:33
Thanks ! I was just looking for it.
Reply | Reply with quote | Quote
 

Add comment


Security code
Refresh

Sections


Last articles

Undefined property suite à u... Qu'est-ce que StageVideo ?... XML Manager : XML online edi... Problème de pixels verts dan... Récupérer les informations E... Contrôler un SWF externe - E... Gérer les polices avec la bi... Module Joomla SeCatordion - ... Quelle version de PHP pour J... firstElementChild / firstChi...

Sondages

Do you think HTML5 can completely replace Flash ?
 
Would you be interested in an online XML editor ?
 

Paypal

paypal

Code du plugin Joomla AutoSEO 1.2 par www.geek-space.fr