actionscript 3 - as3 php data checking not working in .as file -
please me, can't check php data in .as class here as3 code
if(event.target.data.msg=="all_good"){//here problem ,i can't understand maybe //that's why i'm using package?? lbl.text = "all good"; // or }
php code:
<?php print "msg=all_good"; ?>
update :
varloader.addeventlistener(event.complete, completehandler); function completehandler(event:event):void { if (event.target.data.msg== "no_good"){ staticalvars.errmsg.text = "you entered invalid password!"; } else if (event.target.data.msg == "all_good") { staticalvars.errmsg.text = "you entered correct password!"; } }
hi gyus here whole code. main problem getting php data correctly, see in flash code, can't use data it
package { import flash.display.sprite; import flash.events.* import flash.net.*; import fl.controls.label; public class test extends sprite{ public function test() {senddata("scripts/login.php");} public function senddata(url:string):void { var request:urlrequest = new urlrequest(url); var _vars:urlvariables = new urlvariables(); var loader:urlloader = new urlloader(); loader.dataformat = urlloaderdataformat.variables; request.data = _vars; _vars.fio_t = "ds"; request.method = urlrequestmethod.post; loader.addeventlistener(event.complete, handlecomplete); loader.addeventlistener(ioerrorevent.io_error, onioerror); loader.load(request); } private function handlecomplete(event:event):void { var lbl:label = new label(); var lbl2:label = new label(); lbl2.text = "" + loader.data.msg; /////here, shows me php message lbl2.x = 80; if(event.target.data.msg=="all_good"){ ///// here doesn't, , why ?? lbl.text = "all good"; } addchild(lbl); addchild(lbl2); } private function onioerror(event:ioerrorevent):void { trace("error loading url."); } } }
myphp code is
<?php echo "msg=all_good"; ?>
it should this:
var varloader:urlloader = new urlloader(); varloader.load(new urlrequest("yourfile.php")); // line important variables varloader.dataformat = urlloaderdataformat.variables; varloader.addeventlistener(event.complete, function(event:event):void { trace(event.target.data.msg); });
and php should be:
<?php print "msg=all_good"; ?>
Comments
Post a Comment