/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static function flipHorizontal(obj:DisplayObject):void { var m:Matrix = obj.transform.matrix; m.transformPoint(new Point(obj.width * .5, obj.height * .5)); m.tx = (m.a > 0)?obj.width + obj.x:obj.x - obj.width; m.a = -1 * m.a; obj.transform.matrix = m; } public static function flipVertical(obj:DisplayObject):void { var m:Matrix = obj.transform.matrix; m.transformPoint(new Point(obj.width * .5, obj.height * .5)); m.ty = (m.d > 0)?obj.y + obj.height:obj.y - obj.height; m.d = -1 * m.d; obj.transform.matrix = m; }
URL: http://www.nightdrops.com/2010/quickreference-flipping-displayobjects/