Sunday, 15 August 2010

actionscript 3 - retrieve variables from php and send to a js function via AS3 -



actionscript 3 - retrieve variables from php and send to a js function via AS3 -

can tell me how retrieve response php file im posting , send them js function please.

i have animated gif image in script doesnt show animation. can working too?

the php response in format variable1=blabla&varaibale2=blabla

function sendpixeldata(e:mouseevent):void { capture_mc.visible = false; send_mc.visible = false; txtreturn.htmltext="uploading image......<img src="loading.gif" /><br/> please wait!"; var output:string = ""; var col = ""; (var i:number=0; i<bitmapdata.height; i++) { (var j:number=0; j<bitmapdata.width; j++) { col = bitmapdata.getpixel(j,i).tostring(16); // in cases, color truncated (e.g. "00ff00" becomes "ff00") // adding missing zeros. while (col.length<6) { col = "0" + col; } output += col; } } var request:urlrequest = new urlrequest("getpixeldata.php"); var variables:urlvariables = new urlvariables(); var myurlloader:urlloader = new urlloader(); variables.pixels=output;// image pixel //trace("output" + output) variables.width=videopreviewwidth;// video width variables.height=videopreviewheight;// video height request.data=variables; request.method=urlrequestmethod.post; myurlloader.addeventlistener ("complete", onc); myurlloader.load (request); function onc (e) { var result:string = externalinterface.call( "redirecttourl(send variables here)" ); trace ("save complete"); } }

the result php stored in info property of urlloader, retrieve use:

function onc (e:event) { var result:string = string(e.target.data); ...etc

for part 2 of question, flash doesnt back upwards gif file format - need utilize jpg or png.

btw, dont utilize strings event types - utilize event type constant, eg:

myurlloader.addeventlistener (event.complete, onc);

php actionscript-3 flash

No comments:

Post a Comment