6 Replies Latest reply on Nov 10, 2017 1:54 PM by kglad

    Usage of CreateJS in Adobe Animate CC for adding external image on HTML5 Canvas

    popolino17 Level 1

      I would like to ask community how to implement addChild function in HTML5 Canvas type in Animate CC. The purpose is to load external image in the MovieClip container (imageContainer).

      Here is a very simple scenario:

      On the Canvas there are a MovieClip container (by name “imageContainer”) and button (by name “getContent_btn”). The code listed below doesn’t work?

       

      Here is defined functions for image loading using CreateJS

       

      function loadImage() {

        var preload = new createjs.LoadQueue();

        preload.addEventListener("fileload", handleFileComplete);

        preload.loadFile("someimage.png");

      }

       

      function handleFileComplete(event) {

      this.imageContainer.addChild(event.result);

      }

      And here is button function and listener

       

      this.getContent_btn.addEventListener("click", fl_MouseClickHandler.bind(this));

       

      function fl_MouseClickHandler()

      {

         loadImage();

      }

       

      Thanks in advance!