I need to be able to trigger a function that quietly waits inside an object build function.
A hypothetical example:
[code]local xSpacing = 0
function buildBoxes()
local box = {}
local i
for i = 1,4 do
box[i] = display.newRect(20,20,20,20)
box[i].isVisible = false
local function wakeupThisBox() – PROBLEM LINKING FUNCTION TO OBJECT
box[i].x = xSpacing
box[i].isVisible = true
end
end
end
buildBoxes()
box[1].isVisible=true
function wakeUpBoxes()
local n
for n = 2,4 do
xSpacing = xSpacing + 25
box[n]:wakeupThisBox() – PROBLEM TRIGGERING THE OBJECT’S INTERNAL FUNCTION
end
end
box[1]:addEventListener(“tap”,wakeUpBoxes)
[/code]
In this example script, I am building 4 boxes and hiding 3. I then have a listener on the first box to trigger the wake up function. I want that function to then space the boxes and wake them up via their own internal linked function.
I’ve commented the 2 lines of code syntax that I am unsure of how to implement. I’ve looked for examples but I’m not finding any. Any help is appreciated.
If you are unsure of what I am trying to do…please ask…I will try to clarify further. Thanks for helping (hopefully)! [import]uid: 9492 topic_id: 8113 reply_id: 308113[/import]