Skip to content

Instantly share code, notes, and snippets.

@edgarberm
Created January 11, 2013 23:14
Show Gist options
  • Save edgarberm/4514765 to your computer and use it in GitHub Desktop.
Save edgarberm/4514765 to your computer and use it in GitHub Desktop.
Rotating BitmapData
var bmd:BitmapData = new BitmapData(myBitmap.height, myBitmap.width, false, 0x000000);
var matrix:Matrix = new Matrix();
matrix.translate(-myBitmap.width / 2, -myBitmap.height / 2);
matrix.rotate(90 * (Math.PI / 180));
matrix.translate(myBitmap.height / 2, myBitmap.width / 2);
bmd.draw(myBitmap, matrix);
var bm:Bitmap = new Bitmap(bmd);
var sp:Sprite = new Sprite();
sp.addChild(bm);
addChild(sp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment