Jump to content

BringToTop doesn't work for child of child sprite


bymafmaf
 Share

Recommended Posts

Hi!

 

I have a sprite which has some children. I run

this.world.bringToTop(mainSprite);

and it works well. However, it applies only to children of mainSprite, not child of one of its children. For example mainSprite.child is brought to top but mainSprite.child.child doesn't..

 

Is it a bug or I am missing something?

Link to comment
Share on other sites

Sorry for late answer. I've had to change the code. But I think it's straightforward,

parentSprite = this.add(0,0,'someKey');childSprite = this.add(10,10, 'anotherKey');greatChildSprite = this.add(20,20, 'differentKey');childSprite.addChild(greatChildSprite);parentSprite.addChild(childSprite);game.world.bringToTop(parentSprite); //this brings only parentSprite and childSprite to top, not greatChildSprite
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...