Tuesday, 15 July 2014

actionscript 3 - using AS3 to send data to a php file -



actionscript 3 - using AS3 to send data to a php file -

i'm trying utilize urlloader it's not working , don't know why..

i've created php file have uploaded. here's php code :

<?php $pspreregemail=$_post['seml']; $frm_id=$_post['sid']; $psbd=$_post['sbd']; echo "email=".$pspreregemail; echo "&id=".$frm_id; echo "&db=".$psbd; ?>

here as3 code :

var request:urlrequest = new urlrequest('http://www.mysite.fr/login.php') var variables:urlvariables = new urlvariables() variables.seml = 'steph4' variables.sid = 'steph5' variables.sbd = 'steph6' request.data = variables request.method = urlrequestmethod.post var loader:urlloader = new urlloader(); loader.addeventlistener(event.complete, handlecomplete); loader.load(request) function handlecomplete(event:event) { var loader:urlloader = urlloader(event.target) var vars:urlvariables = new urlvariables(loader.data) trace('vars.email: '+vars.email) trace('vars.id: '+vars.id) trace('vars.db: '+vars.db) }

no errors, when i'm going @ http://www.mysite.fr/login.php displays : email=&id=&db=

why don't see : ???

email=steph4 id=steph5 db=steph6

i'm starting wonder if it's possible send info air app php file on server ?? maybe it's because, security measure, it's impossible send info url ?

your as3 code fine, in php code should :

<?php $pspreregemail = $_post['seml']; $frm_id = $_post['sid']; $psbd = $_post['sbd']; echo "email=".$pspreregemail."&id=".$frm_id."&db=".$psbd; ?>

about question, why don't want when open http://www.mysite.fr/login.php ? because $_post array empty , vars empty. should run project , :

vars.email: steph4 vars.id: steph5 vars.db: steph6

php actionscript-3 flash air urlloader

No comments:

Post a Comment