Skip to main content
kglad
Community Expert
Community Expert
April 5, 2024
Answered

anybody else notice this canvas/easeljs peculiarity?

  • April 5, 2024
  • 2 replies
  • 3901 views

it's not possible to reparent a symbol created with drawing tools and added from the library or created on-stage (draw whatever > convert to symbol) unless it's removed (and that's not doable via removeChild) first from the stage.  ie,

 

this.box.addChild(this.circle); 

/* won't work with on-stage instances of this.box and this.circle without prior removal of this.circle*/

 

 

 

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    still doing that:

     

    this.stop();
     
    this.box1.addChild(this.cc);  // works wth cc instance on main stage
     
    // box mc instances of box which has child cc
    this.box1.rotation = 45;
    this.box2.rotation -= 22.5;
    stage.on("drawend", function(){console.log("H"); this.box1.addChild(this.box2.cc); }, this, true);  // fails
    //stage.on("drawend", reparentF.bind(this));  // fails
     
    stage.update();
     
    function reparentF(){ 
    this.box1.addChild(this.box2.cc);
    }

    What does happen if you call stop on this.box2 first?

    2 replies

    Inspiring
    April 18, 2024

    If you enable the _off property it will remove a child from the list of managed children. If animated you will also need to remove any tweens that target it from the timeline if such tween sets a state or _off property.

    JoãoCésar17023019
    Community Expert
    Community Expert
    April 6, 2024

    Hi, k.

     

    You need to call this.stop() even if the timeline has only one frame - because it seems it continues playing - for display list's methods to work properly.

     

    Regards,

    JC

    kglad
    Community Expert
    kgladCommunity ExpertAuthor
    Community Expert
    April 6, 2024

    ohhh, that sounds promising.  testing.