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";