8 Replies Latest reply on Sep 20, 2007 9:33 PM by Roadman730

# Flip image

Anyone has idea on how to flip an image?
• ###### 1. Flip image

You could try setting the scaleX and/or scaleY properties to -1.

I havent tried it in Flex, but I also found this method which uses the Matrix() class,
"Flip Horizontal / Vertical a BitmapData with Matrix" on Flash Kit Community Forums
• ###### 2. Re: Flip image
If the image is JPEG format, is it possible to use Matrix?
• ###### 3. Re: Flip image

Peter
• ###### 4. Re: Flip image
Load it in at runtime. I am using the Matrix approach. It work fine. Thanks!!

BTW, I have query on the Matrix.rotate method.
How can i make the same effect as the <mx:Rotate> effect using the Matrix.rotate ? It is not work as well as using the mxRotate..
The rotation origin is not at the center of the target object..
• ###### 5. Re: Flip image

If you want to rotate around a certain point, you may need to use the Matrix "translate()" method before and after the rotation.

For example, before the rotation, translate() to -img.width/2 and -img.height/2. Then rotate, then translate() to +img.width/2 and +img.height/2.

Does that make sense? basically move the image by half the width and height then move back after the rotation is complete.

For more information on Matrix manipulations you can check out the documentation http://livedocs.adobe.com/flash/9.0/main/00000188.html (there are a few pages of docs, so hit the "next page" button a couple times), and Senocular.com has an excellent resource over at http://www.senocular.com/flash/tutorials/transformmatrix/.

Hope that helps. Happy Flexing!
Peter
• ###### 6. Re: Flip image
Manu thanks, Peter!!
How can I rotate exactly 90 degree? I convert the degree to radians. however, it does not work as the <mx:Rotate>. What i want to do is to rotate the image clockwise 90 degree like "Windows Picture and Fax Viewer".

Sorry for asking dummy question.! haha~