当我点击btn1
button
时,我希望将txt
TextField
添加到btn1
{{的文本中1}}应该是button
中的文字。
textField
import flash.ui.Mouse;
import flash.events.MouseEvent;
import flash.text.TextField;
var txt:TextField = new TextField;
txt.text = "Click here to find MH370";
addChild(txt);
btn1.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{
this.addChild(txt);
});
是btn1
btn1
button
我得到了错误:
Symbol
我做错了什么?
看我的工作是:
行动脚本:
要查看大图像:http://i.stack.imgur.com/vKE2Q.jpg 和 http://i.stack.imgur.com/OwHmT.jpg
答案 0 :(得分:2)
尝试:
import flash.ui.Mouse;
import flash.events.MouseEvent;
import flash.text.TextField;
var txt:TextField = new TextField;
txt.text = "Click here to find MH370";
btn1.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{
(btn1.upState as DisplayObjectContainer).addChild(txt);
});