It seems whenI use the delay function, it calls the showAlert function twice. When I remove the delay and just show the alert it works fine. Not sure if this is a bug or if my logic is wrong. Can anyone help?
–Reload the Trick
local function onComplete(event)
local action = event.action
if “clicked” == event.action then
if 2 == event.index then
localGroup:removeSelf()
director:changeScene(“mainmenu”)
elseif 1 == event.index then
initVar()
end
end
return true
end
–Show Alert to Replay or go to main menu
local function showAlert()
print (“Hello”)
local alert = native.showAlert(“Replay”, “Guess your Card Again?”, {“OK”, “Cancel”}, onComplete)
end
–Show the Card
local function showAnswer()
deck.isVisible = false
myText.isVisible = false
local theCardIs = table.concat(pickedCards,"",11,11)
local answerText = display.newText(“This is your card!”,0,0,system.nativeFontBold,20)
answerText.x = screenCenterX
answerText.y = screenCenterY / 4
localGroup:insert(answerText)
answerShow = display.newImageRect(theCardIs, 75,100)
answerShow.x = screenCenterX
answerShow.y = screenCenterY
localGroup:insert(answerShow)
timer.performWithDelay(3000, showAlert )
end [import]uid: 11809 topic_id: 5937 reply_id: 305937[/import]