8 Replies Latest reply on Apr 14, 2017 3:42 PM by thomasw72287590

    Access images within the library

    thomasw72287590 Level 1

      I need to be able to access the actual image from the library so I can do this:

       

      function drawShape() {

          console.log('draw shape');

          overlay = new createjs.Shape();

          stage.addChild(overlay);

         

          overlay.graphics.clear()

              .beginBitmapFill(img)

              .drawRect(0,0,800,600);

        overlay.cache(0, 0, self.canvas.width, self.canvas.height);

      }

       

      var img = new Image();

      img.onload = drawShape;

      img.src = "test.png";

       

      Do anyone know how to grab the image from either the library directly or from an MC holding the image?
      Just to be clear I need to the actual image file so I can manipulate it directly. Simply loading an MC containing the image or loading the image via linkage will not work. Not unless I can use either of those to grab the image.