1 Reply Latest reply on Dec 6, 2017 1:42 PM by kglad

    HOW TO REPLACE / SWAP AN IMAGE WITH ANIMATION IN ANIMATE CC + CREATEJS?

    jose luizk70942370

      In animate cc I have an animation made on timeline for "image 01"

       

      how to replace in runtime the "image 01" for another external image AND preserving the animation timeline for this new image?

       

      I was able to insert image 01 and insert an external image 02 with CreateJs, but this second image comes without the animation.

       

      This is my code, It replaces image 01 for image 02, but the animation does not work on image 02

       

       

      wthis = this;

      var preload = new createjs.LoadQueue();

       

       

      this.loadImage = function (wthis) {

           preload.addEventListener("fileload", handleFileComplete);

           preload.loadFile({

               src: "images/2.jpg",

               id: 'img2'

           });

      }

       

      function handleFileComplete(event) {

           var img2= preload.getResult("img2");

           var bmp = new createjs.Bitmap(img2);

           wthis.Img1.addChild(bmp);

      }

       

      this.bt2.addEventListener("click", f_MouseClickHandler.bind(this));

       

      function f_MouseClickHandler()

      {

           wthis.Img1.gotoAndPlay(2);

      }