Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 如何从as3中的另一个电影剪辑更改舞台上的文本字段?_Actionscript 3_Flash_Actionscript - Fatal编程技术网

Actionscript 3 如何从as3中的另一个电影剪辑更改舞台上的文本字段?

Actionscript 3 如何从as3中的另一个电影剪辑更改舞台上的文本字段?,actionscript-3,flash,actionscript,Actionscript 3,Flash,Actionscript,如何从AS3中的另一个电影剪辑更改舞台上的文本字段 在StatusEvent(完成)处理程序中 提前感谢您如何在舞台上放置文本字段?您可以通过名称获取文本字段上的引用 var myTextField: TextField = stage.getChildByName("someName") as TextField; if(myTextField != null){ myTextField.text = "New text"; }else{ trace("Can't find t

如何从AS3中的另一个电影剪辑更改舞台上的文本字段

StatusEvent
(完成)处理程序中


提前感谢

您如何在舞台上放置文本字段?您可以通过名称获取文本字段上的引用

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";
//Give some name for text field on scene in Flash IDE, for example: myText
myText.text = "new Text";