我对AS3比较陌生。我现在有一些代码问题,我希望在这个论坛上得到一些建议。基本上,我正在为我的网站创建一个表单。我有一个组合框,我希望用户在字段中输入他们的电子邮件地址和密码。然后单击submit按钮登录并验证他们输入的内容是否正确。当我实时运行我的代码时,我得到一个错误1120:访问未定义的属性status_Txt。我不知道status_Txt是什么意思。我从我读过的教程中复制了这段代码的一大部分。我的代码如下:有人能告诉我如何解决这个问题吗?
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.MouseEvent;
import fl.data.DataProvider;
import flash.events.Event;
//Building the variables
var phpVars:URLVariables = new URLVariables();
//Requesting the php file
var phpFileRequest:URLRequest = new URLRequest("http://www.example.com");
phpFileRequest.method = URLRequestMethod.POST;
phpFileRequest.data = phpVars;
//Building the loader
var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, showResult);
//Variables ready for processing
phpVars.email = txt_input.text;
phpVars.p_swd = pass.text;
phpLoader.load(phpFileRequest);
btn_one.addEventListener(MouseEvent.CLICK, btnHandler);
function btnHandler(event:MouseEvent):void{
trace("Login success");
}
//Validate form fileds
function showResult(event:Event):void{
status_Txt.text = "" + event.target.data.systemResult;
trace(event.target.data.systemResult);
}
var cbox:Array = new Array();
boy[0] = "Male";
girl[1] = "Female";
c_one.dataProvider = new DataProvider(cbox);
c_one.addEventListener(Event.CHANGE, dataHandler);
function dataHandler(e:Event):void{
trace(e.target.value);
}
}发布于 2013-03-19 05:18:40
您正在尝试访问一个不存在的对象。status_Txt在以下位置被引用:
function showResult(event:Event):void{
status_Txt.text = "" + event.target.data.systemResult; //Either remove this or add a textfield to the stage with the instance name status_Txt
trace(event.target.data.systemResult);
}https://stackoverflow.com/questions/15486845
复制相似问题