This entry was posted
on Wednesday, June 11th, 2008 at 4:02 pm and is filed under Actionscript3, Code.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
7 Responses to “As3 Flip Vertical and Flip Horizontal”
Very nice example, but i have trouble:
when i’m trying to flip object with text (i.e. label, button) I don’t see text after flipping.
After appplying flip once more, text appear back.
Any suggestions ?
June 18th, 2008 at 4:59 pm
Hi, Thank u for sharing. I’ve post it to my blog for reference and send a trackback to you.
http://kevincao.com/2008/06/17/as3-flip-vertical-and-flip-horizontal
July 2nd, 2008 at 3:58 pm
Very nice example, but i have trouble:
when i’m trying to flip object with text (i.e. label, button) I don’t see text after flipping.
After appplying flip once more, text appear back.
Any suggestions ?
July 2nd, 2008 at 4:20 pm
ah…
sorry
If you want to do something like flip with objects with text, you must use embed fonts.
July 2nd, 2008 at 6:45 pm
Yes, otherwise the fonts aren’t eligible to be rasterized into bitmaps.
August 15th, 2008 at 2:36 pm
Hi, I´m not sure what your code does, but I think it´s easier like this:
vertical:
dsp.scaleY = -dsp.scaleY;
horizontal:
dsp.scaleX = -dsp.scaleX;
August 18th, 2008 at 11:59 pm
xleon,
Your method doesn’t work with video, while the others do.
August 27th, 2008 at 12:49 pm
to switch back and forth, use this:
function flipHorizontal(dsp:DisplayObject):void
{
var matrix:Matrix = dsp.transform.matrix;
//matrix.a = -1;
matrix.a *= -1;
//matrix.tx = dsp.width + dsp.x;
matrix.tx = -matrix.a * dsp.width + dsp.x;
dsp.transform.matrix = matrix;
}
function flipVertical(dsp:DisplayObject):void
{
var matrix:Matrix = dsp.transform.matrix;
//matrix.d = -1;
matrix.d *= -1;
matrix.ty = -matrix.d * dsp.height + dsp.y;
//matrix.ty = dsp.height + dsp.y;
dsp.transform.matrix = matrix;
}