2010-04-02 43 views
1

我在檢查兩個textfield.text比較時遇到了一些問題。一個TextField.text值來自計算,另一個textField來自用戶輸入。當我檢查這兩個文本時,TextField.text值沒有顯示,我無法比較這兩個文本。我如何在actionscript 2.0中進行比較。請幫幫我!提前致謝!actionscript 2.0:檢查flash中的TextField

回答

1

如果textFields設置正確,你所做的一切應該沒問題。

下面是它如何工作的例子:

//with the text tool, make two textFields on the stage 
//In the Properties window, set the instance name of one to 'dynamicText' 
//and set it's text type to be Dynamic Text 
//Set the other one to be named 'inputText' 
//and make it of text type Input Text 
//enter some dummy text in each field to start with 

dynamicText.text="pAssw0rd" //for example 

inputText.onChanged= function() { 
trace("match is "+(dynamicText.text == inputText.text));//true or false 
} 

現在運行這一點,並嘗試在inputText字段中鍵入...