change screens using a set timer

hi all

could anyone please advise on how to change from one to screen to another screen using a timer

i.e if there is a home-screen menu, (homescreen.lua) it automatically changes to level 1 (level1.lua) after 30 seconds.

many thanks in advance for any help

much appreciated [import]uid: 10239 topic_id: 3791 reply_id: 303791[/import]

use the director class

then use a timer with a delay to call your function to change the page [import]uid: 6645 topic_id: 3791 reply_id: 11529[/import]

dear sir

thank-you very much for your reply- i have the function set up at the moment as a touch button to go from one screen to the other, however im still having trouble trying to change this function to a timer to go to “level3” automatically after 30 seconds

thanks in advance


local bt02 = display.newImage(“images/bt_moveFromRight.png”)
local function bt02t ( event )
if event.phase == “ended” then
director:changeScene(“level3”,“moveFromRight”)
end
end
bt02:addEventListener(“touch”,bt02t)
bt02.x = 240
bt02.y = 80
localGroup:insert(bt02) [import]uid: 10239 topic_id: 3791 reply_id: 11533[/import]

this should work [lua]local function changeToScene3(event)

director:changeScene(“level3”,“moveFromRight”)

end

timer.performWithDelay(30000, changeToScene3)

local function bt02t ( event )
if event.phase == “ended” then
changeToScene3()
end
end[/lua] [import]uid: 6645 topic_id: 3791 reply_id: 11541[/import]

thank-you very much! this works really good. i really appreciate the help.

i have used this function (see code below) in the game where there is a timer where you only have a few seconds to complete the particular level.
if you don’t complete the level in-time it goes to gameover… this part works great, however if i complete the level and get on to the next one, the timer doesn’t stop and still goes to gameover screen.

im trying to work out how to group this function into the scene (to stop this happening) to stop it moving over to the next scene… if you have any ideas would be really appreciated

thanks again in advance!

local function changeToGameover(event)

director:changeScene(“gameover”,“overFromTop”)

end

timer.performWithDelay(3000, changeToGameover)

local function bt ( event )
if event.phase == “ended” then
changeToGameover()
localGroup:insert(changeToGameover)
end
end
[import]uid: 10239 topic_id: 3791 reply_id: 11568[/import]

Guys, please write your questions at Director’s sub-forum. I don’t have too much time to answer and I really didn’t see most of the topics created for Director. I’m sorry for that and I will appreciate if you all could go to this link:

http://developer.anscamobile.com/forums/director-class [import]uid: 8556 topic_id: 3791 reply_id: 18694[/import]