7 Replies Latest reply on Aug 2, 2016 10:14 AM by kglad

    createJS:Bitmap

    JonnyDL Level 1

      I've been looking at createJS code for working with images. Im looking to bring in an image/bitmap from the library. I thought I had found some code to do it, but it does nothing. It compiles, but gives me nothing. Here is the Code, is there a reason why it isn't working (the circle was my first test, and I kept it as a check that the code was compiled without error.)

      Can you bring an image in this way? If not how?

           

       

      var circle = new createjs.Shape();

      circle.graphics.beginFill("DeepSkyBlue").drawCircle(0, 0, 50);

      circle.x = 100;

      circle.y = 100;

      stage.addChild(circle);

       

      createjs.Tween.get(circle, { loop: false })

        .to({ x: 200 }, 1000, createjs.Ease.getPowOut(12))

       

      //createjs.Tween.get(this.square_mc, { loop: true})

      // .to({ x: 300 }, 3000, createjs.Ease.getPowInOut(12));

       

      var image = new createjs.Bitmap("Sandies pic9.png"); //In library

      var MC_Container = new createjs.Container();

      MC_Container.addChild(image);

      MC_Container.x=100;

      stage.addChild(MC_Container);

      stage.update();

        • 1. Re: createJS:Bitmap
          kglad Adobe Community Professional & MVP

          that's for loading bitmaps.

           

          to use a library bitmap, assign a linkage id (eg, Sandies_pic9) and use:

           

          var image=new lib.Sandies_pic9;

          • 2. Re: createJS:Bitmap
            JonnyDL Level 1

            Thanks for the quick reply.

            I've seen that code before, and it didn't work/compile for me. thats why I went looking for other ways.

            I tried using what you had above, just to see if it would work, but it didn't compile?

            I am placing it as is directly into the actions window (below my shape code) am I missing something?

            Screen Shot 2016-08-01 at 1.44.11 PM.png

            • 3. Re: createJS:Bitmap
              just.emma Level 4

              Did you assign a linkage ID?

              Screen Shot 2016-08-01 at 10.48.13 AM.png

              1 person found this helpful
              • 4. Re: createJS:Bitmap
                JonnyDL Level 1

                Wow Thanks! I have never used the Linkage before (didn't know it was an option, Duh). In AS2 AS3 it was a MovieClip and an instance.

                Apparently you use the linkage name in the code (Sandies_pic9). That makes sense now.

                     Thanks Again!

                • 5. Re: createJS:Bitmap
                  ClayUUID Adobe Community Professional

                  JonnyDL wrote:

                   

                  I've been looking at createJS code for working with images. Im looking to bring in an image/bitmap from the library. I thought I had found some code to do it, but it does nothing. It compiles, but gives me nothing.

                  Canvas mode uses JavaScript. It is not compiled. There are no compile errors. What you do get are run-time errors

                  • 6. Re: createJS:Bitmap
                    JonnyDL Level 1

                    Clay

                       That was my BAD/LAZY (amateur) choice of words/wording. I can't remember the errors. Once KGLAD gave me a clue at what I was doing wrong and understood it, I got to work staring to try and and build a particle system (snow falling) using Animate CC, CreateJS, and Javascript. I did one before in AS2 I just need to see if I can figure it out in Javascript.

                    Thanks for the response, I appreciate the help.

                    • 7. Re: createJS:Bitmap
                      kglad Adobe Community Professional & MVP

                      you're welcome.

                       

                      p.s. message 1 should be marked correct and message 3, helpful.