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

 Share

  • Recently Browsing   0 members

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