i am still in confusion with alert messages.

Hey guys,

you may have seen my previous posts about alert messages, but i am still in confusion on how to apply and fully function them with my app. I am trying to get this accomplished; when the triangle is dragged through the maze and touches the F, i would like a pop up like an alert message coming up that says “Congratulations, you won!” Then i would like two options that say Main Menu (if clicked takes you back to the main menu) and Next Level (if clicked takes you to the next level). I know this is a lot, but i do not fully understand the concept behind this. Here is my code, and i would be greatly appreciative to get help from anyone.

local physics = require("physics")  
physics.start()  
local ui = require("ui")  
local gameUI = require("gameUI")  
physics.setGravity(0, 0)  
--delete setdrawmode when done with adding all the physics......  
physics.setDrawMode("hybrid")  
  
module(..., package.seeall)  
local localGroup  
function new()  
 localGroup = display.newGroup()  
 print( "Level 1" )  
  
  
 local sky = display.newImage( "Turqouise Back.png", 0, 0 )  
localGroup:insert(sky)  
  
local button = display.newImage( "Main Menu.png" )  
local function buttont ( event )  
media.playEventSound( "Robot Blip.caf" )  
 if event.phase == "ended" then  
 director:changeScene("Menu","moveFromLeft")  
 end  
 end  
 button:addEventListener("touch",buttont)  
 button.x = 260  
 button.y = 34  
 physics.addBody( button, "static", {friction=.5, bounce=.5 } )  
 localGroup:insert(button)  
  
  
local leftWall = display.newRect(0, 0, 1, display.contentHeight )  
localGroup:insert(leftWall)  
local rightWall = display.newRect(display.contentWidth, 0, 1, display.contentHeight )  
localGroup:insert(rightWall)  
local ceiling = display.newRect(0, 0, display.contentWidth, 1 )  
localGroup:insert(ceiling)  
  
physics.addBody(leftWall, "static", { bounce = 0.0} )  
physics.addBody(rightWall, "static", { bounce = 0.0} )  
physics.addBody(ceiling, "static", { bounce = 0.0} )  
  
local ground = display.newImage("ground.png")  
ground.x = 160; ground.y = 490  
physics.addBody( ground, "static", { friction=0.5, bounce=0.0 } )  
localGroup:insert(ground)  
  
local wall = display.newImage( "Shortwall1.png", 100, 400 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 150, 400 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall2.png", 150, 386 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall2.png", 0, 400 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 150, 350 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall2.png", 150, 300 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 100, 350 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 100, 300 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 250, 300 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 100, 215 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall2.png", 100, 201 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 200, 122 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall2.png", 50, 120 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 50, 133 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 50, 200 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 50, 280 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 0, 280 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 0, 200 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 0, 133 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 0, 50 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall2.png", -10, 50 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 150, 48 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 150, 0 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 100, -22 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 250, 228 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall1.png", 250, 90 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
local wall = display.newImage( "Shortwall2.png", 150, 78 )  
physics.addBody(wall, "static", {density = 10.0, friction = 30.0, bounce = 0.0} )  
localGroup:insert(wall)  
  
function hitTestObjects(obj1, obj2)  
 local left = obj1.contentBounds.xMin \<= obj2.contentBounds.xMin and obj1.contentBounds.xMax \>= obj2.contentBounds.xMin  
 local right = obj1.contentBounds.xMin \>= obj2.contentBounds.xMin and obj1.contentBounds.xMin \<= obj2.contentBounds.xMax  
 local up = obj1.contentBounds.yMin \<= obj2.contentBounds.yMin and obj1.contentBounds.yMax \>= obj2.contentBounds.yMin  
 local down = obj1.contentBounds.yMin \>= obj2.contentBounds.yMin and obj1.contentBounds.yMin \<= obj2.contentBounds.yMax  
 return (left or right) and (up or down)  
end  
local img1 = display.newImage("triangle.png")  
local img2 = display.newImage("F.png")  
local function drag(event)  
 if event.phase == "moved" then  
 img1.x = event.x  
 img1.y = event.y  
 print(hitTestObjects(img1, img2))  
 end  
end  
img1:addEventListener("touch", drag)  
physics.addBody( img1, "dynamic", { bounce = 0 , density = 2, friction=0.7, isSensor=true} )--  
physics.addBody( img2, ("dynamic") { bounce = 0 , density = 2, friction=0.7} )--  
local function collide(event)  
 if event.phase == "began" then  
 print ("COLLIDING")  
 end  
end  
img1:addEventListener("collision", collide)  
  
return localGroup  
end  

sorry about the code being so long. [import]uid: 19836 topic_id: 8764 reply_id: 308764[/import]

http://developer.anscamobile.com/reference/index/nativeshowalert [import]uid: 12108 topic_id: 8764 reply_id: 31993[/import]