Skip to main content
Participating Frequently
February 10, 2020
Question

Cannot reorder displaylist objects not instantiated via javascript from the library (Canvas)

  • February 10, 2020
  • 1 reply
  • 165 views

In a Canvas project, if a MovieClip is dragged from the library to the stage, it cannot be removed using this.removeChild(theClip). Its position in the displaylist cannot be changed visually. 

 

For example, if you build a game where draggable pieces are lain out in inside a movieclip, at runtime you cannot bring the selected piece to the front. If you use stage.setChildIndex(theClip, stage.numChildren - 1) for example, nothing happens other than the value of stage.getChildIndex(theClip) - which shows that it has moved to the top but visually the MC is still where it was.

 

If the MC was added by code using something like myClip = new lib.MyClip() everything works as expected. However, if that clip has anything nested inside of it, none of those instances can have addChild, removeChild, setChildIndex etc applied to them.

 

Unfortunately, it makes it so that I cannot use Animate to design game interface layouts as I did in the Flash days. I hope that there is a switch that I can flip that I am missing which will fix this. Is there an option somewhere to resolve this?

This topic has been closed for replies.

1 reply

Legend
February 10, 2020

In CreateJS 1.0.0, even single-frame movieclips loop by default, which continuously resets their display lists. Just give your containers a stop().