0
如何更改舞臺上的文本框從另一個影片剪輯在AS3提前如何從as3中的另一個MovieClip更改舞臺上的textField?
如何更改舞臺上的文本框從另一個影片剪輯在AS3提前如何從as3中的另一個MovieClip更改舞臺上的textField?
你如何將文本字段在舞臺上
在StatusEvent
(完整的)處理
stage.texfield.text = "test"; //Not Working
this.parent.textfield.text = "test"; //NOt Working
謝謝?您可以通過名稱獲得有關TextField的參考。
var myTextField: TextField = stage.getChildByName("someName") as TextField;
if(myTextField != null){
myTextField.text = "New text";
}else{
trace("Can't find text field on the Stage");
}
但是,你應該給它一個名字,當你在創建過程:
var newField: TextField = new TextField();
//code for initialisation of the text field
newField.name = "someName";
如果您在Flash IDE中創建文本字段,所以它不是在舞臺上,在給它一個名字現場,並訪問它:
//Give some name for text field on scene in Flash IDE, for example: myText
myText.text = "new Text";