[問題] 指定變數的問題

看板Flash作者 (不可或缺的咖啡因)時間18年前 (2007/08/11 13:53), 編輯推噓4(402)
留言6則, 2人參與, 最新討論串1/1
^^"有個問題想來這發問,請高手教一下,因為一直想不通。 var testNumA : Number = 0; var testNumD : Number = 0; function testFunB(){ for (testNumA=1;testNumA<=x;testNumA++){ this["test"+testNumA].onRelease = function (){ testNumD = this["test"+testNumA].testNumA testFunE() } } } function testFunE(){ for (i=0;i<y;i++){ testWord_txt.text = ["xxx"+i+"_Array"][testNumD].xxxxx } } ^^"想請問,因為上面是我原本寫錯的方式,要如何才能夠將 this["test"+testNumA].onRelease的testNumA的值 代入testNumD呢? 麻煩各位,謝謝。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.178.144

08/11 19:56, , 1F
你好像沒有指定 this["test"+testNumA].testNumA 的值啊
08/11 19:56, 1F

08/12 00:04, , 2F
= = 意思是說,要先指定嗎?可以教我一下嗎?高手^^
08/12 00:04, 2F

08/12 13:10, , 3F
其實你的程式蠻微妙的 我看不出來你要幹嘛XDD
08/12 13:10, 3F

08/12 13:11, , 4F
在 onRelease 函數的前面你要先
08/12 13:11, 4F

08/12 13:12, , 5F
this["test"+testNumA].testNumA=testNumA
08/12 13:12, 5F

08/12 14:20, , 6F
^^感謝!真的發現是自己寫錯嚕~3Q
08/12 14:20, 6F
文章代碼(AID): #16lKx54b (Flash)
文章代碼(AID): #16lKx54b (Flash)