Using Directory With Timer Corona Sdk

0

down vote

favorite

I’m trying to use the directory with the “Recipes” example… I have a problem with the timer

after I run the main.lua page it should show my logo and welcome massage then , it should go to intro page where I have a screen to get the user name and mobile only when he use the application for first time and save it into txt file , then next time it will check that txt file…

next , it will direct to “Menu” page where user can Select from

my problem that in the main.lua I use timer to show the logo, but this timer still work in other screens .

Main.lua (cdoe)

_w = display.viewableContentWidth

_h = display.viewableContentHeight

local background = display.newRect(0,0,_w,_h) background:setFillColor( 234, 234, 234 )

local obj = display.newImage( “ams_logo.jpg” )

– center the object obj.x = display.contentWidth*0.5 obj.y = display.contentHeight*0.5

– fade object to completely transparent local transition_id = transition.from( obj, { time=2000, alpha=0 } )

–local textObject = display.newText( “Welcome to AMS project”, 20, 350, native.systemFont, 24 ) local textObject = display.newText( “Welcome to AMS project”, _w*.1, _h*.8, native.systemFont, 24 ) textObject:setTextColor( 255,144,0 ) local transition_id = transition.from( textObject, { time=1500, alpha=0 })

function changeScene (e) if(e.phase == “ended”) then director:changeScene(e.target.scene) end

end

local director = require(“director”); local mainGroup = display.newGroup();

mainGroup:insert(director.directorView); display.setStatusBar(display.HiddenStatusBar) _W = display.contentWidth _H = display.contentHeight number = 0

function fn_counter()

director:changeScene(“intro”);

end timer.performWithDelay(5500, fn_counter, 0)

the intro .lua

module(…, package.seeall)

function new()

local introGroup = display.newGroup();

    local background = display.newImage(“graphics/intro_background.png”)

    local begin = display.newImage(“graphics/begin_button.png”)

    begin.x = 160; 

    begin.y = 400;

    begin.scene = “menu”;

    introGroup:insert(background);

    introGroup:insert(begin);

    begin:addEventListener(“touch”, changeScene);

return introGroup;

end

please help me …