Native Alert problem

Hi everybody um having a small problem with native alert ok the problem is when I click on next Level (to go to next level), or click redo (repeat the level) The native alert would show up again after I click what do you think is the problem here is the

[code]local function onClicks(event)
if event.action == “clicked” then
if event.index == 1 then
saveit.save()
saveit.save()
saveit.save()
saveit.save()
director:changeScene (“gameselect”, “flip”)
elseif event.index == 2 then
saveit.save()
saveit.save()
saveit.save()
saveit.save()
director:changeScene (“level2”, “fade”)
end
end
end
– Display Alert

function onCollision5( event )
if event.phase == “began” and event.other.name == “bg22” then
physics.pause()
_G.twolock = 1
local alerts = native.showAlert(“Congratulations”, “Level 1”, {“Main Menu”, “Next Level”}, onClicks)
end
end
ball.preCollision = onLocalPreCollision
ball:addEventListener( “collision”, onCollision5) [/code]

There’s nothing wronG as I see (I think)

Help is appreciated [import]uid: 17058 topic_id: 20100 reply_id: 320100[/import]

Hey,

First up - I see you’re using saveit.save() multiple times - you only really need to use that once. (Or twice, once for each click.)

Try cancelling the alert immediately before changing scenes to see if that helps; http://developer.anscamobile.com/reference/index/nativecancelalert

Peach :slight_smile: [import]uid: 52491 topic_id: 20100 reply_id: 78657[/import]

@peach thanks for the help :slight_smile: [import]uid: 17058 topic_id: 20100 reply_id: 78769[/import]