Skip to main content
Participating Frequently
June 4, 2020
Answered

Bring object to front dynamically doesn't work anymore

  • June 4, 2020
  • 1 reply
  • 718 views

Hello, I followed other threads to bring objects to the front dynamically through all the following scripts in HTML5.

 

// ES5 setChildIndex

this.bringToFront = function(e) {

    e.currentTarget.parent.setChildIndex(e.currentTarget, e.currentTarget.parent.numChildren - 1);

}

 

// ES6 setChildIndex

this.bringToFront = (e) => {

    e.currentTarget.parent.setChildIndex(e.currentTarget, e.currentTarget.parent.numChildren - 1);

}

 

// ES5 addChild

this.bringToFront = function(e) {

    e.currentTarget.parent.addChild(e.currentTarget);

}

 

// ES6 addChild

this.bringToFront = (e) => {

    e.currentTarget.parent.addChild(e.currentTarget);

}

 

None of these methods work any more. Maybe there was an update. Could anyone tell an alternate way?

This topic has been closed for replies.
Correct answer ClayUUID

When Animate updated to CreateJS 1.0.0, they made a change that caused single-frame movieclips to loop continuously instead of just playing once and stopping. This causes the movieclip's display list to continuously reset.

 

So just stop() your container clips.

1 reply

ClayUUIDCorrect answer
Legend
June 4, 2020

When Animate updated to CreateJS 1.0.0, they made a change that caused single-frame movieclips to loop continuously instead of just playing once and stopping. This causes the movieclip's display list to continuously reset.

 

So just stop() your container clips.

ruturaj20Author
Participating Frequently
June 5, 2020

Thanks a lot 😄