Saturday, 4 December 2010

AS3: Flip Movieclip horizontally

surprised how weak the code examples were, here is how I done it:
rightArrowMov = new MovieClip();
addChild(rightArrowMov);
rightArrowBit = new Bitmap(LoaderMax.getContent("arrow").rawContent.bitmapData);

flipHorizontalMatrix = new Matrix();
flipHorizontalMatrix.scale(-1,1);

rightArrowMov.transform.matrix = flipHorizontalMatrix;
rightArrowMov.addChild(rightArrowBit);
Its easy, load the bitmap, create the matrix, then apply the matrix to the MovieClip the bitmap was loaded into.

No comments:

Post a Comment