Need help with removing display objects in new scenes

 Hello,

My partner and I are currently working on an gaming App right now and we have run into a problem, We have the first screen ready, (i.e… Start button, Leaderboards, Rankings…) and when we click start, and we go to the game screen, then the game starts to run, we can still click the Start and leaderboard buttons in our game menu and it will transition us to either of the screens we click and the game continues to run in the background. What function do we use to show a new screen once you click a button and not be able to click the button when playing the game? composer.removeHidden? We are trying to find out how to get rid of this issue.

Any help is appreciated!

-Roland

Sounds like the buttons that you can still click are not being added to the sceneGroup of the menu screen, which is why they are not being moved off screen when the game starts.

If you want Composer to manage the scene, all objects must be inserted into the scene’s view group.  This is not optional.  For convenience we alias the scene’s view group as:

sceneGroup

inside of scene:create(), scene:show(), scene:hide() and scene:destory().   That way you can do:

local obj = display.newImageRect("someimage.png", 100, 50) sceneGroup:insert( obj )

If you create things in functions that are not part of scene:create(), scene:show(), scene:hide() or scene.destroy() then you would do:

local obj = display.newImageRect("someimage.png", 100, 50) scene.view:insert( obj )

When you do this, Composer will transition your objects off screen when you change scenes.  This will make buttons unavailable until they transition back on screen.  When you remove a scene, objects in the scene’s view will be removed for you automatically.

The two biggest hangups for using Composer is not putting things in the scene’s view group and not understanding how the scene’s event’s flow.

Rob

Horace and Rob, we have fixed the issue to where we can’t click on the buttons when we play the game. (By the way the earlier problem was the buttons were invisible, but we could still click them.) Now another problem has arisen, for some reason, what ever we changed, we can not transition back to the main menu from our leaderboards page and our in-game pause page. We were able to go back and switch between pages before, but now we can click play and leaderboards, and we go to those screens, but it appears that the main menu button isn’t processing and allowing us to change back to the home page. Any idea’s why that may happen and how to fix it?

Sounds like the buttons that you can still click are not being added to the sceneGroup of the menu screen, which is why they are not being moved off screen when the game starts.

If you want Composer to manage the scene, all objects must be inserted into the scene’s view group.  This is not optional.  For convenience we alias the scene’s view group as:

sceneGroup

inside of scene:create(), scene:show(), scene:hide() and scene:destory().   That way you can do:

local obj = display.newImageRect("someimage.png", 100, 50) sceneGroup:insert( obj )

If you create things in functions that are not part of scene:create(), scene:show(), scene:hide() or scene.destroy() then you would do:

local obj = display.newImageRect("someimage.png", 100, 50) scene.view:insert( obj )

When you do this, Composer will transition your objects off screen when you change scenes.  This will make buttons unavailable until they transition back on screen.  When you remove a scene, objects in the scene’s view will be removed for you automatically.

The two biggest hangups for using Composer is not putting things in the scene’s view group and not understanding how the scene’s event’s flow.

Rob

Horace and Rob, we have fixed the issue to where we can’t click on the buttons when we play the game. (By the way the earlier problem was the buttons were invisible, but we could still click them.) Now another problem has arisen, for some reason, what ever we changed, we can not transition back to the main menu from our leaderboards page and our in-game pause page. We were able to go back and switch between pages before, but now we can click play and leaderboards, and we go to those screens, but it appears that the main menu button isn’t processing and allowing us to change back to the home page. Any idea’s why that may happen and how to fix it?