isvisible vs removeChild

I’ve been programming a platform game in Corona for the past week and it’s been going pretty well. I have the levels set up with tiles, so that only the relevant graphics for the current screen state are displayed.

The way I was doing it was using removeChild() to remove cells that were no longer displayed on screen, and then adding new movieclips to the stage. You can tell I come from an AS3 environment.

I read through the Corona Photoshop article just now and saw the object function isVisible. Would it be better to add all my sprites/cells to the stage and then toggle their visibility rather than removing ones that are no longer of use?

Marty [import]uid: 7548 topic_id: 1560 reply_id: 301560[/import]

In Beta 7 you actually can’t remove and then reinsert a display object, so yeah, for any display object that you’re going to use again and want to keep in memory, use isVisible, and for any that your done with, remove it. [import]uid: 6678 topic_id: 1560 reply_id: 4434[/import]

Well…

  1. You can move (insert) them into a placeholder group…

  2. You can “isVisible=false” them

  3. As images are cached it is possible to just display.newImage() it on every use

Last possibility may be better if you have a lot of changing stuff and use the same! images in multiple locations… it is much easier to just “remove” them all and create new ones for the next state of the game than to keep track of all the individual objects and their usage. [import]uid: 6928 topic_id: 1560 reply_id: 4437[/import]