I’ve tried two sets of code - both don’t work. When I run them, nothing shows up on screen and the object doesn’t display.
Why doesn’t this code work to show a rect and not return until it is displayed?
function itsAlive()
G_testAlive=1
end
function displayAndWaitForItToAppear(msg)
local obj=display.newRect(0,0,100,100)
G_testAlive=0
timer.performWithDelay(1000,itsAlive)
while G_testAlive==0 do
– nothing
end
end
displayAndWaitForItToAppear()
I’ve also tried a runtime “enterframe” listener and that didn’t work, either.
function itsAlive()
G_testAlive=1
end
function displayAndWaitForItToAppear(msg)
local obj=display.newRect(0,0,100,100)
G_testAlive=0
obj:addEventListener(“runtime”,itsAlive)
while G_testAlive==0 do
– nothing
end
end
displayAndWaitForItToAppear()