groups. Thought I had the hang of 'em, guess not.

I start with

local background = display.newImage(“myscreen.png”)
menuScreen:insert( background )

and later, when I no longer need or want that backgroup, I use:

menuScreen:remove(background)

So far so good.

Now I’m adding in the instruction pages. In the initial event that calls the first instruction page I do:

menuScreen:remove(background)  
tutorialPage1 = display.newImage("tutorialPage1.png")  
tutorialScreen:insert(tutorialPage1)  

and add an event listener for page turns. One possibility in the event listener is that the user wants to go back to the main screen. My code sorta looks like this:

tutorialScreen:remove(tutorialPage1)  
if(user wants to go back to main screen) then  
 Runtime:removeEventListener( "touch", tutorialTouch );  
 menuScreen:insert( background )  
 gotoMainMenu(event)  
end  

The problem is that the image described by “tutorialPage1” never goes away, and “background” never appears.

How come?

Thanks,

Sean.
[import]uid: 4993 topic_id: 578 reply_id: 300578[/import]

Well, I still don’t understand why it doesn’t work. However, after scouring the forum, I finally ran across something that solved the problem.

When the user wants to go back to the main menu, I use the following code (one line added from original):

tutorialScreen:remove(tutorialPage1)  
if(user wants to go back to main screen) then  
 Runtime:removeEventListener( "touch", tutorialTouch );  
 tutorialScreen.isVisible = false menuScreen:insert( background )  
 gotoMainMenu(event)  
end  

However, I still don’t understand the relationship to screens/groups and what’s displayed onscreen. Is there any good explanation of that somewhere?

Thanks,

Sean. [import]uid: 4993 topic_id: 578 reply_id: 1124[/import]

I am having some similar problems which we suspect are to do with garbage collection and elements hanging around. This is, apparently, a common problem with iPhone app and you need to almost force a item to be removed at times.

However, I can’t for the life of me find the syntax to do this :slight_smile:

I have a couple of layers of buttons and images (each forming a page). I place the button images without the tap event, then turn it on when the page is shown … then off when the page is left. All well and good. However, the buttons are being left active (I am also using removeEventListener).

Any ideas?

Cheers

Gary [import]uid: 4523 topic_id: 578 reply_id: 1229[/import]