سؤال

I want my object(Object A) to be on top of all other objects, all of my objects are inserted to a group, and each second a new object is created and inserted to the group, in the scene which makes Object A(always on top) to be set below in the new object. I can't find anything in the corona docs. thanks in advance

هل كانت مفيدة؟

المحلول

In corona the latest object you add to a group will always show on top of the other, but you can use the object:toFront() function to move an object to the front.

https://docs.coronalabs.com/api/type/DisplayObject/toFront.html

نصائح أخرى

Basically, You have to create new viewGroup for every single layer.

For example:

local background_group = display.newGroup() --first group will be background one
local close_background_group = display.newGroup() --second group - in front of first.
local foreground_group = display.newGroup() --third - in front of second, etc.

If Your foreground contains only one object - it is going to be always on the top layer.

If You'd provide any code sample You're working with, it would be easier to help You more.

Relevant reference: group programming guide

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top