transition.to() help

I have main.lua and level1.lua, I have created function in main.lua then call it in level1.lua

The problem is When i click manu button everything goes great, but when i click it again everything is good except form menu button not coming back to its position. i don’t know why. Any help would be much appreciated.

[code]
– Here is my main.lua file where i created function
— SIDE MENU FOR EACH LEVEL COME FROM THE left
game.sideMenu = function(sideMenu)
–if game.pause then
if menuOverlayGroup then
transition.to(menuOverlayGroup, {time = 200, y = 400})
menuOverlayGroup = nil

else
menuOverlayGroup = display.newGroup()
game.playEventSound(game.soundPressed)
menuOverlay = display.newRect(0, 400, 100, 130)
transition.to(menuOverlay,{time = 200, y = 255 })
menuOverlayGroup:insert(menuOverlay)

end
end
– And here is the code from level1.lua
local menuButton

– When Menu button pressed
local function menuPressed(b)
game.playEventSound(game.soundPressed)
if game.menuOverlayGroup then
transition.to(menuButton, {time = 200, y = 294})
else
game.sideMenu()
transition.to(menuButton, {time = 200, y = 180})
game.playEventSound(game.soundPressed)

end
end
– Add menu button
menuButton = button:create(group,1,{x=30,y=294,w=45,h=45,handler=menuPressed},“buttons/menuicon.png”)
[import]uid: 11559 topic_id: 20738 reply_id: 320738[/import]

Really need plug and play for this, or a sample download that actually runs to give a solid answer.

That said, I can’t see where the menu is being “told” to go back to it’s position when the scene loads; is it meant to be automatic or on touch? [import]uid: 52491 topic_id: 20738 reply_id: 81445[/import]

I got it to work. But thank you , you always been very helpful. [import]uid: 11559 topic_id: 20738 reply_id: 81524[/import]

I’m happy to hear that - well done! (And thanks :))

Peach [import]uid: 52491 topic_id: 20738 reply_id: 81634[/import]