director problem!

  
module(..., package.seeall)  
  
function new()  
  
local creditGroup = display.newGroup()  
local voltaa, voltarMenu  
  
 voltaa = display.newRect( 350, 280, 80, 50 )  
 creditGroup:insert( voltaa )  
  
  
 voltarMenu = function(e)  
 if e.phase == "ended" then  
 director:changeScene( "menu" )  
 end   
 end   
  
 voltaa:addEventListener( "touch", voltarMenu )  
 return cretiGroup()  
end  

Why the scene dont change??

I have menu.lua and works fine… I got this scene of cretis from menu scene… now I cant back for her
What should I do?

[import]uid: 23063 topic_id: 13259 reply_id: 313259[/import]

This is wrong:

return cretiGroup() [import]uid: 31262 topic_id: 13259 reply_id: 48642[/import]

sorry I have put a “()” here… but in my code this “()” does not exist [import]uid: 23063 topic_id: 13259 reply_id: 48644[/import]

It is also spelled incorrectly. In your code did you spell it creditGroup and not cretiGroup? [import]uid: 31262 topic_id: 13259 reply_id: 48647[/import]

hehe again I have write wrong here =x
sorry…

in my code are creditGroup as the “return creditGroup”

sorry [import]uid: 23063 topic_id: 13259 reply_id: 48649[/import]

perhaps you should copy/paste exactly what you have in the .lua file you are getting this code from. [import]uid: 28912 topic_id: 13259 reply_id: 48665[/import]

[code]
module(…, package.seeall)

function new()

local creditGroup = display.newGroup()

local unloadME
local bg

bg = display.newImageRect( “home_bg.png”, 480, 320 )
bg.x = _W/2
bg.y = _H/2
creditGroup:insert( bg )

local textoResetaJogo

textoResetaJogo = display.newText( “Reset Game”, 350, 150, nil, 18 )
creditGroup:insert( textoResetaJogo )
local resetaGame

resetaGame = function(e)
if e.phase == “ended” then
reseta.somaReset()
end

end

local voltaa, voltarMenu

voltaa = display.newRect( 350, 280, 80, 50 )
creditGroup:insert( voltaa )

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

textoResetaJogo:addEventListener( “touch”, resetaGame )
voltaa:addEventListener( “touch”, voltarMenu )
return creditGroup
end
[/code] [import]uid: 23063 topic_id: 13259 reply_id: 48686[/import]

somone can tell me why this code didnt work??

transition.to( loadGroup, { delay = 1000, time = 1000, alpha = 0 } )  
 timer.performWithDelay( 2000, function() director:changeScene( "jogo" ); end, 1 )  
  

I have jogo.lua in my file

this director is going me crazy!! >.<

sometimes work in Corona’s Simulator… but when I try in Xcode’s Simulator… this code do not worked!

someone help me please =( [import]uid: 23063 topic_id: 13259 reply_id: 48743[/import]

Try separating the function something like this

[code]
local function nextScene()
director:changeScene( “jogo” )
end

transition.to( loadGroup, { delay = 1000, time = 1000, alpha = 0 } )
timer.performWithDelay( 2000, nextScene, 1 )
[/code] [import]uid: 31262 topic_id: 13259 reply_id: 48770[/import]

didn’t work too =T

someone have another idea? [import]uid: 23063 topic_id: 13259 reply_id: 48879[/import]

I don’t remember very well but with director don’t you have to send a 2nd parameter when calling the next scene? Something like this:

director:changeScene( "jogo", "fade" )   

I could be wrong [import]uid: 31262 topic_id: 13259 reply_id: 48888[/import]

this “fade” is a effect and you don’t need to use
is optional, as far as I know [import]uid: 23063 topic_id: 13259 reply_id: 48891[/import]

please, Someone can help me??

I will copy and paste my 2 .lua files to you can see and search for an problem
my mainmenu.lua:

[code]module(…, package.seeall)

function new()

local localGroup = display.newGroup()

– Variaveis
local background
local start
local howToPlay
local credits

– Funcoes
local menu
local startFuncao
local startFade
local howToPlayFuncao
local howToPlayFade
local creditsFuncao
local creditsFade

menu = function()


– BackGround

background = display.newImageRect( “home_bg.png”, 480, 320 )
background.x = _W/2
background.y = _H/2
localGroup:insert( background )

– Escrita “escape”

textoEscape = display.newImageRect( “escape_titulo.png”, 136, 39 )
textoEscape.x = 340
textoEscape.y = 40
localGroup:insert( textoEscape )

– Escrita “escape”

textoHospital = display.newImageRect( “hospital_escape.png”, 164, 42 )
textoHospital.x = 390
textoHospital.y = 80
localGroup:insert( textoHospital )

– Start

botaoStart = movieclip.newAnim( { “start.png”, “start2.png” }, 68, 24 )
botaoStart.x = 330
botaoStart.y = 160
localGroup:insert( botaoStart )

– How To Play

howToPlay = movieclip.newAnim( { “howtoplay.png”, “howtoplay2.png” }, 165, 24 )
howToPlay.x = 390
howToPlay.y = 230
localGroup:insert( howToPlay )

– Credits

credits = movieclip.newAnim( { “credits.png”, “credits2.png” }, 91, 30 )
credits.x = 330
credits.y = 290
localGroup:insert( credits )
--------------\—//------------------\—//-----------------
---------------\-//--------------------\-//------------------
loadInventory()

– Funcoes
startFuncao = function()
director:changeScene( “loading” )
end

howToPlayFuncao = function()
director:changeScene( “howToPlay” )
end

creditsFuncao = function()
director:changeScene( “configuracoes” )
end

startFade = function()
botaoStart:play()
system.vibrate()
timer.performWithDelay( 500, function() botaoStart:stop(); end, 1 )
transition.to( botaoStart, { delay = 500, time = 1500, alpha = 0, onComplete = startFuncao } )
transition.to( localGroup, { delay = 1200, alpha = 0 } )
end

howToPlayFade = function()
howToPlay:play()
system.vibrate()

timer.performWithDelay( 500, function() howToPlay:stop(); end, 1 )

transition.to( howToPlay, { delay = 500, time = 1500, alpha = 0, onComplete = howToPlayFuncao } )
transition.to( localGroup, { delay = 1200, alpha = 0 } )
end

creditsFade = function()
credits:play()
system.vibrate()

timer.performWithDelay( 500, function() credits:stop(); end, 1 )

transition.to( credits, { delay = 500, time = 1500, alpha = 0, onComplete = creditsFuncao } )
transition.to( localGroup, { delay = 1200, alpha = 0 } )
end
--------------\—//------------------\—//-----------------
---------------\-//--------------------\-//------------------
– Touchs Listeners
botaoStart:addEventListener( “touch”, startFade )

howToPlay:addEventListener( “touch”, howToPlayFade )

credits:addEventListener( “touch”, creditsFade )
--------------\—//------------------\—//-----------------
---------------\-//--------------------\-//------------------

end

menu()

return localGroup
end [/code]
and now my configuracoes.lua:
module(…, package.seeall)

function new()

local creditGroup = display.newGroup()

local bg

bg = display.newImageRect( “home_bg.png”, 480, 320 )
bg.x = _W/2
bg.y = _H/2
creditGroup:insert( bg )

local textoResetaJogo

textoResetaJogo = display.newText( “Reset Game”, 350, 150, nil, 18 )
creditGroup:insert( textoResetaJogo )
local resetaGame

resetaGame = function(e)
if e.phase == “ended” then
reseta.somaReset()
end

end

local voltaa, voltarMenu

voltaa = display.newRect( 350, 280, 80, 50 )
creditGroup:insert( voltaa )

voltarMenu = function(e)
if e.phase == “ended” then
print( “aaaaa” )
director:changeScene( “mainmenu” )
end
end

textoResetaJogo:addEventListener( “touch”, resetaGame )
voltaa:addEventListener( “touch”, voltarMenu )
return creditGroup
end [/code]
when I touch in this Rect, I have “aaaa” in terminal… but director dont change the scene =SS
EDIT: sorry but the “code” dont work in secound script =T [import]uid: 23063 topic_id: 13259 reply_id: 49339[/import]

anyone??
I need help with this director problem [import]uid: 23063 topic_id: 13259 reply_id: 51130[/import]