Alert/Notification help

for some reason this "alert" pops up as soon as the level starts up, i only want it to pop up when somebody presses the "skip" button, how can i make it do this? thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
local skip = display.newImage ("skip.png")
localGroup:insert(skip)
skip.x = 305
skip.y = 50
 
local function onComplete( event )
        print( "index => ".. event.index .. "    action => " .. event.action )
 
        local action = event.action
        if "clicked" == event.action then
                if 2 == event.index then
        
                        director:changeScene ("mainmenu")
                end
        elseif "cancelled" == event.action then
        end
end
 
local alert = native.showAlert( "Skip Level?", "Are you sure you want to skip this level?", { "Cancel", "Yes" }, onComplete )

Add this to your skip button code:

1
skip:addEventListener("touch", skipTouched)
views:1387 update:2011/10/3 8:06:12
corona forums © 2003-2011