Display Object Priority?

Hi Everyone,

I am currently trying to make a night time shade always be over certain objects. I have the shade working and it covers everything at first but after certain objects leave the screen and get recreated they appear above the night shade. Is there any way to make a object always be above other objects even if they are recreated?

Thanks,
Chris [import]uid: 126017 topic_id: 23796 reply_id: 323796[/import]

Yes, check out API for displayGroup:insert ().
http://developer.anscamobile.com/reference/index/groupinsert

There is a first parameter, an optional one, which sets z-index of the newly inserted element.
Z-index is order in which elements are laid out.
If you just use group:insert ( object )
then object will be inserted with at the end, and its z-index will be the number of children objects in the group - which means it will always appear over previously added objets.
if you use
group:insert ( 1, object)
now you specified z-index of 1, which means object will always be BEHIND other objects.

likewise, you can specify any other z-index which will define where in display order the newly inserted object will be added.
ie.
group:insert ( group.numChildren-1, object )
will insert it just behind the last previously added objects and above the rest.
Cheers
N
[import]uid: 80100 topic_id: 23796 reply_id: 95817[/import]

Thank you very much this helps alot. [import]uid: 126017 topic_id: 23796 reply_id: 95836[/import]