作者lisa2923 ( )
看板Flash
标题[问题] 阵列物件
时间Wed Aug 12 10:22:02 2009
用as3.0写的
var lchat=new Array();
var lm=new Array();
var li:uint =0;
lokopen.addEventListener(MouseEvent.CLICK ,lopenchat);
function lopenchat(me:MouseEvent ){
this["lchat"+li]=new lbtn();
this.parent.addChild(this["lchat"+li]);
trace(typeof(this["lchat"+li])); //显示 object
this["lm"+li]=new lm1();
this.parent.addChild(this["lm"+li]);
trace(typeof(this["lm"+li])); //显示object
this["lchat"+li].addEventListener(MouseEvent.MOUSE_OVER ,lover)
function lover(me:MouseEvent ){
trace("hello")
} //有出现 hello
li++;
}
把黄色部份换成
this["lchat"+li].addEventListener(MouseEvent.MOUSE_OVER ,lover)
function lover(me:MouseEvent ){
this["lm"+li].x+=50;
}
却出现TypeError: Error #1010: 词汇未定义且没有属性。
请问这样是哪里出了问题?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.114.120.188
1F:→ aquarianboy:你的lm1()是什麽? 08/12 10:37
2F:→ lisa2923:lml是一个影片片段,类似讯息框 08/12 11:00
3F:推 cjcat2266:function lover()定义移到最外层试试看 08/12 12:02
4F:推 aquarianboy:附个原始档会比较好猜 08/12 12:54