Reputation: 1
How can I change the textField on the Stage from Another MovieClip in AS3
In the StatusEvent
(complete) handler
stage.texfield.text = "test"; //Not Working
this.parent.textfield.text = "test"; //NOt Working
Thanks in advance
Upvotes: 0
Views: 80
Reputation: 2885
How do you place text field on the Stage? You could get reference on the TextField by name.
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");
}
But you should give it a name, when you are creating it:
var newField: TextField = new TextField();
//code for initialisation of the text field
newField.name = "someName";
If you create text field in Flash IDE, so It is not on the Stage, give it a name on the scene, and access it:
//Give some name for text field on scene in Flash IDE, for example: myText
myText.text = "new Text";
Upvotes: 2