作者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
→ aquarianboy:你的lm1()是什麼? 08/12 10:37
→ lisa2923:lml是一個影片片段,類似訊息框 08/12 11:00
推 cjcat2266:function lover()定義移到最外層試試看 08/12 12:02
推 aquarianboy:附個原始檔會比較好猜 08/12 12:54