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 ?
3
piggy said at 4:20 pm on July 2nd, 2008:
ah…
sorry
If you want to do something like flip with objects with text, you must use embed fonts.
4
Idoru said at 6:45 pm on July 2nd, 2008:
Yes, otherwise the fonts aren’t eligible to be rasterized into bitmaps.
+ Help the community
+ Explore the Flash platform
+ Create a better world
+ Research and play
Startups
We're looking for stories about startups using Flex/Flash technology. Drop us a quick e-mail or mention it to us via our Twitter account @dreaminginflash, thanks!
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
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 ?
ah…
sorry
If you want to do something like flip with objects with text, you must use embed fonts.
Yes, otherwise the fonts aren’t eligible to be rasterized into bitmaps.
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;
xleon,
Your method doesn’t work with video, while the others do.
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;
}
Does anyone know how the Michael’s code woulde be if the image had a bigger or smaller scale and a rotation angle?
Can anybody help in maintaining the same position while flipping.
[...] dreaminginflash.com Comments (0) [...]
Fantastic!!
Thank you very much
Thanks, just what I was looking for!
Thanks! It worked smoothly!
Appriciate your work…Please use this for toggle flip :
public function flipHorizontal(event:Event):void
{
var matrix:Matrix = selectedGraphic.transform.matrix;
trace(matrix.a);
if(matrix.a == 1)
{
matrix.a=-1;
}
else
{
matrix.a=1;
}
selectedGraphic.transform.matrix=matrix;
}
public function flipVertical(event:Event):void
{
var matrix:Matrix = selectedGraphic.transform.matrix;
if(matrix.d == 1)
{
matrix.d=-1;
}
else
{
matrix.d=1;
}
selectedGraphic.transform.matrix=matrix;
}