actionscript3.0post表单

as3.0 post提交数据并获取返回值

zc_submit.addEventListener(MouseEvent.CLICK,f_submit);
zc_reset.addEventListener(MouseEvent.CLICK,f_reset);
function f_submit(e:MouseEvent){
if(zc_user.text==""){error_user.visible=true;return;}
if(zc_email.text==""){error_email.visible=true;return;}
var variables:URLVariables=new URLVariables();
variables.zc_user=zc_user.text;
variables.zc_email=zc_email.text;
var request:URLRequest=new URLRequest("http://localhost/post.php");
request.method=URLRequestMethod.POST;
request.data=variables;
var loader:URLLoader=new URLLoader();
loader.addEventListener(Event.COMPLETE,loader_complete);
loader.load(request);
function loader_complete(event:Event){
return_text.text=loader.data;
}
}
function f_reset(e:MouseEvent){
zc_user.text="";
zc_email.text="";
error_user.visible=false;
error_email.visible=false;
}

你可能感兴趣的:(as3.0)