https://docs.coronalabs.com/api/type/GroupObject/insert.html
An easy way to move an object above all its siblings (top) is to re-insert it:object.parent:insert( object ).
This might be an implementation question but why does the parent:insert not accept the resetTransform parameter when it is in the current group?
for instance, this code below does not work.
local group = display.newGroup() local group2 = display.newGroup() group:insert(group2) local rect0 = display.newRect(group,10,10,300,300) rect0:setFillColor(.20,.40,.5) local rect = display.newRect(group2,0,0,100,100) local options = { parent = group2, font = native.systemFont, fontSize = 23, x = 10, y = 40, align = "left", text = "hello" } local text = display.newText(options) group2:translate(0,100) -- some code later.. function group2:updateAndReset() -- update text, do some .fill print("y before resetTransform", self.y) group:insert(self, true) print("y after resetTransform", self.y) --or i could do this --self.x = 0 --self.y = 0 -- or --self:translate(0,-100) --self:toFront() end group2:updateAndReset()
and if i was to add rotation, or some scaling, i would also have to reset those too.