要與這裏的第一個答案走就是一個例子:
local starTable = {}
local star1 = <display object>
starTable:insert(star1)
local function showStarTable()
starTable.alpha = 1
end
timer.performWithDelay(500, showStarTable, 1)
local function hideStarTable()
starTable.alpha = 0
end
timer.performWithDelay(1000, hideStarTable, 1)
你想堅持用實際的表或。並沒有看到什麼是真正被插入到你的啓動的,你可以嘗試:
local starTable = {}
local star = <display object>
starTable[1] = star
star = <display object>
starTable[2] = star
star = <display object>
starTable[3] = star
local function showStarTable()
for i=1, #starTable do
starTable[i].star.alpha = 1
end
end
timer.performWithDelay(500, showStarTable, 1)
local function hideStarTable()
for i=1, #starTable do
starTable[i].star.alpha = 0
end
end
timer.performWithDelay(1000, hideStarTable, 1)
然而,第一個選項是更好的,如果它與你的程序。
starTable包含哪些元素? – atok 2013-02-24 09:12:17