1 Reply Latest reply on Aug 31, 2006 9:12 AM by abeall

    Rotating Bitmap Data

    cmalumphy
      I would like to know how to load bitmapdata (a gif) and position it within a movieclip so that I could rotate the bitmap data around the bitmap data's center point rather than its 0,0 coordinate in the upper left hand corner. Does anyone have a brief example or description as to how this could be done? I don't have a problem doing this when I create the graphic using actionscript, but I can't figure out how to do it with a bitmap. Thanks for any tips or advice.
        • 1. Rotating Bitmap Data
          abeall Level 3
          You might be able to do this with the Matrix object, but I haven't been able to figure it out. The Matrix has generally confused me.

          An alternative would be to attach the BitmapData in another MovieClip, and just center that. So something like this:

          createEmptyMovieClip('myMovieClip_mc',getNextHighestDepth());
          myMovieClip_mc.createEmptyMovieClip('myBitmap_mc',myMovieClip_mc.getNextHighestDepth());
          myMovieClip_mc.myBitmap_mc.attachBitmap(myBitmap_bmp,myMovieClip_mc.myBitmap_mc.getNextHig hestDepth(),null,true);
          myMovieClip_mc.myBitmap_mc._x = -myBitmap_bmp.width/2;
          myMovieClip_mc.myBitmap_mc._y = -myBitmap_bmp.height/2;
          //now you can rotate myMovieClip_mc and it will rotate the bitmap around it's center
          myMovieClip_mc._x = Stage.width/2;
          myMovieClip_mc._y = Stage.height/2;
          myMovieClip_mc.onEnterFrame = function(){
          this._rotation+=5;
          }