Flash AS3 (actionscript 3) Helps: Flip MovieClip Horizontally with Matrix Class

The Flash Actionscript 3 Matrix class represents a transformation matrix that determines how to map points from one coordinate space to another. You can perform various graphical transformations on a display object by setting the properties of a Matrix object, applying that Matrix object to the matrix property of a Transform object, and then applying that Transform object as the transform property of the display object. These transformation functions include translation (x and y repositioning), rotation, scaling, and skewing.

Here’s a sample that uses the Matrix class to flip a Movie Clip horizontally:

function flipHorizontal(dsp:DisplayObject):void {
var matrix:Matrix=dsp.transform.matrix;
matrix.transformPoint(new Point(dsp.width/2,dsp.height/2));
if (matrix.a>0) {
matrix.a=-1*matrix.a;
matrix.tx=dsp.width+dsp.x;
} else {
matrix.a=-1*matrix.a;
matrix.tx=dsp.x-dsp.width;
}
dsp.transform.matrix=matrix;
}
//usuage
flipHorizontal(myMC)