看板 Flash 關於我們 聯絡資訊
※ 引述《icedesign (不可或缺的咖啡因)》之銘言: : function test() { : for (var i:Number = 1; i<=6; i++) { this["test"+i+"_btn"].i = i; //加這行 : this["test"+i+"_btn"].onRelease = function() { : if (i=1) { : //trace(i); trace(this.i); //改成this.i,其它以此類推 : } : if (i=2) { : trace(i); : } : if (i=3) { : trace(i); : } : if (i=4) { : trace(i); : } : if (i=5) { : trace(i); : } : if (i=6) { : trace(i); : } : }; : } : } : test(); 應該這樣就行了 另外,即然這麼多個if,建議可以改用switch-case的方式 :) 供你參考 -- http://www.eddie.com.tw/blog/ http://www.eddie.com.tw/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.133.136.105