I’m trying to get an object “obj1” to show(isVisible = true) at the push of a button. (it’s a yellow rect)
using – timer.performWithDelay(1000, newListener ), a new rect “obj2” will show and “obj1” will hide.
then “obj3” at 2 seconds show and obj2 hide, just like that in a sequence.
– That’s easy I can do that so far.
I have a “stop” button, or “done” or “reset” button
so when people push that button “everything” must end or stop.
I have one function for each “obj”
local function yellow1 () local function obj11Listener( event ) obj1.isVisible = true end timer.performWithDelay( 200, obj1Listener ) end local function yellow2 () local function obj2Listener( event ) obj1.isVisible = false obj2.isVisible = true end timer.performWithDelay(3130, obj2Listener ) end
like that.
in another function I call all of them at the same time
local function pennyTap () local function play () audio.play(pennySong) end transition.to(pennyImageLarge, {time=200, x=display.contentWidth / 2, y=display.contentHeight / 2, xScale=1, yScale=1, alpha=1, onComplete=play}) transition.to(done, {time=200, y=700}) yellow1() yellow2() yellow3() yellow4() -- and so on end
in the done button I have this
local function doneStop () audio.stop() transition.to(done, {time=200, y=900}) transition.to(pennyImageLarge, {time=200, x=pennyImage.x, y=pennyImage.y, xScale=.1, yScale=.1, alpha=0}) obj1.isVisible = false obj2.isVisible = false obj3.isVisible = false obj4.isVisible = false end
even when all the objects are = false
because of the previews calls I keep seeing the rects show and hide
how can I solve this problem?
any suggestions on a new and better approach for this problem?
thanks for your help.