Removing a display object from a group, without destroying it

Heya,

Is there a way of removing an image from a group without implicitly calling removeSelf on it? My impression is that group:remove(obj) destroys the display object and leaves you with a Lua table (based on the API description).

I want to keep the object about, I just don't want it in that group any more. At the moment, I've created a temporary group, which I insert the object into, in order to force it out of the original parent group, which is horrible really, because it means I wind up with a group I really never wanted!

Thanks,

Why not just make it invisible by setting .isVisible=false?

Setting it invisible wasn't really an option. Basically, I wanted to get the total height of all objects in a group, bar that object. In the end I've just added a field to it, which I check when iterating though it.

@don Thanks for the tip. That's the route I'll go down in the future, I hadn't though about the stage being a group object.

Thanks,

I think your initial approach of using a field on the object is a better approach, because you seemingly don't want to remove the object from the group :-)

Or just get the total height of all objects in the group, then subtract the height of that object. You don't have to mess around with moving objects to different groups or adding special fields.

views:1398 update:2011/9/28 8:56:32
corona forums © 2003-2011