Skip to main content
Participant
December 5, 2017
Répondu

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

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);

}

Ce sujet a été fermé aux réponses.
Meilleure réponse par kglad

animate a movieclip.

use addChild to add your image to the animated movieclip.

1 commentaire

kglad
Community Expert
kgladCommunity ExpertRéponse
Community Expert
December 6, 2017

animate a movieclip.

use addChild to add your image to the animated movieclip.