Create multiple groups, group those groups into master group and remove master group?

Ok so yea, the title says it all

I created a group called ui and game. I then created a master group called Mgroup.

I then made a start button that removes the ui group, which in this case is the start button and the instruction text about the start button.

I then made a remove button that shows text at the bottom, that removes EVERYTHING that's part of the master group (Mgroup)

phew, that was confusing. It works, but I don't know if it's right, or what but I was having some fun so yea here you go.

View on ipad in simulator to see everything :)

Don't give me a hard time about indenting, and formatting and clean code this isn't a clean code type of thing, just something I have noticed and want to know is it a valid way of doing things?

ng :)

EDIT ** 10/07/11 - I added these 2 things:

1
2
 ui = nil
 Mgroup = nil

Nowhere are you setting these display objects to nil. So even though they are getting removed from the stage, the memory allocated to these objects is still being held. The result will be a memory leak.

Check this out: http://blog.anscamobile.com/2011/08/corona-sdk-memory-leak-prevention-101/

@nicholas,

1. if you are after the touch ended phase only, then use a tap instead of touch

2. IMO, the removeSelf() should clean up everything for you in the newer versions and you might have to call the garbageCollection to free the memory.

3. yes, that should work (IMO)

cheers,

?:)

views:1520 update:2011/10/18 8:54:01
corona forums © 2003-2011