the sprite called instance2 was never added to anything since it is added to the stage automatically by when you call sprite.newSprite(spriteSet2). This prevents from being able to control the layering of sprites properly.
but the point of newSprite is to add it to screen, the same as newImage.
if you set it’s alpha to zero, or visible to false, or x offstage, directly after calling newSprite i’m sure you won’t see it. [import]uid: 6645 topic_id: 5406 reply_id: 18161[/import]
Yes, you are right… I do want to add it to the screen.
But i do also want to control which ‘layer’ of the screen the sprite gets added to.
It could be a background tile map or a foreground animated sprite.
if i could do this then i’d be happy
[code]
– these 2 are added automatically to the stage in this order
local bgLayer = display.newGroup();
local fgLayer = display.newGroup();
– i can set up the background and the environment in 1 layer
local skySrite = sprite.newSprite(bgLayer, envSpriteSet)
– without interring with the stuff on this layer
local animatedCreature = sprite.newSprite(fgLayer, creatureSpriteSet)
– but newSprite wont take a parentGroup param
[/code] [import]uid: 22047 topic_id: 5406 reply_id: 18162[/import]
Please correct me if i’m wrong, i think by end of line 4 of your example, skySprite is already on the stage. At least that’s what i’m seeing. Hence the post.
If line 4 doesnt add skySprite to the stage, then i’m wrong and problem solved.
Unless, adding it to bglayer, resets the parent to bglayer? [import]uid: 22047 topic_id: 5406 reply_id: 18210[/import]