2013-03-18 57 views
0

我對AS3比較陌生。我現在有幾個代碼問題,我希望在這個論壇上提供一些建議。 基本上,我正在爲我的網站創建一個表單。我有一個組合框,我希望用戶在字段中輸入他們的電子郵件地址和密碼。 然後點擊提交按鈕登錄並驗證他們輸入的內容是否正確。當我實時運行我的代碼時,出現錯誤 1120:訪問未定義的屬性status_Txt。我不知道status_Txt是什麼意思。 我從閱讀的教程中複製了大部分代碼。我的代碼如下:有人可以告訴我如何解決這個問題。AS3表格查詢

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); 
} 




} 
+0

這與Xcode完全沒有關係。 – 2013-03-18 21:01:00

回答

0

您試圖訪問不存在的對象。 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); 
}