Bring display object to the top of the foreground

Consider the following code:

local square = display.newRect(150, 0, 50, 50)  
square:setFillColor(255,0,0)  
  
local rectangle = display.newRect(0,200, 300, 100)  
  
transition.to(square, {time=2000, y=400})  

The red square passes under the white rectangle. Is there a way I can bring the red square to the foreground so that it passes over the rectangle? I need to do this without declaring the rectangle first. [import]uid: 61552 topic_id: 10830 reply_id: 310830[/import]

Try this

square:toFront() [import]uid: 7845 topic_id: 10830 reply_id: 39374[/import]

http://developer.anscamobile.com/reference/index/objecttofront [import]uid: 12108 topic_id: 10830 reply_id: 39375[/import]

Can’t believe I missed that. Thanks! [import]uid: 61552 topic_id: 10830 reply_id: 39377[/import]