Intro Screen Question

I tried to retro fit an app I’m working on to launch an instructions screen before running the main part of the app. The code I used crashes Corona. If there’s a better way to do this, I’d welcome the help.

bgGroup = display.newGroup()
local background = display.newImage(“background.png”)
bgGroup:insert( background )

–intro screen
local wait = 1

local introDisplay = function()
while wait == 1 do
–endless loop until screen detects touch
end
end

local function introRemove (event)
local t = event.target

local phase = event.phase

if “began” == phase then
instructions:removeEventListener( “touch”, introRemove )
bgGroup:remove(instructions)
wait = 0
end

end

local instructions = display.newImage(“Default.png”)
bgGroup:insert(instructions)
instructions:addEventListener( “touch”, introRemove )
introDisplay()
[import]uid: 1560 topic_id: 378 reply_id: 300378[/import]

introDisplay has an infinite loop in which it will never get out of.

Try this instead

[code]
bgGroup = display.newGroup()
local background = display.newImage(“background.jpg”)
bgGroup:insert( background )

[code]
local function main()
print(“main”);
end

[code]

[code]
local instructions = display.newImage(“main.jpg”)

[code]
bgGroup:insert(instructions)

[code]
function instructions:touch (event)
local phase = event.phase
if “ended” == phase then
print(“ended”)
instructions:removeEventListener( “touch”, instructions )
bgGroup:remove(instructions)
main();
end
end

instructions:addEventListener( "touch", instructions )  

I renamed the images to the ones on my HD so you may have to do the same. [import]uid: 24 topic_id: 378 reply_id: 684[/import]

Great, thanks. [import]uid: 1560 topic_id: 378 reply_id: 685[/import]