You can’t do this on “display.newImage()” itself. It will always load your image to the top of the stage!
You can “insert()” it to another position by giving an index to the insert parameter.
group:insert( [index,] child, [, resetTransform] )
I would suggest something different…
local layers=display.newGroup()
local layer\_top=display.newGroup()
local layer\_back=display.newGroup()
layers:insert(layer\_back)
layers:insert(layer\_top) -- gets on top as last inserted
-- setup done
layers.x=... -- place it where it should go
layers.y=...
-- loading first pic
layer\_top:insert(display.newImage(...))
-- loading second pic (still img1 on top)
layer\_back:insert(display.newImage(...))
-- loop starts here
-- fade out img1 ...
transition.to(layer\_top[1], ....)
-- remove img1 .. move img2 to top
layer\_top:remove(1)
layer\_top:insert(layer\_back[1])
-- load a new image into back layer
layer\_back:insert(display.newImage(...))
--- loop restart
You need to have some controller for the loop of course.
This way it is always clear which layer contains what and you do not need to fiddle with indexes in the stage object. [import]uid: 6928 topic_id: 1358 reply_id: 3717[/import]