Is there a way to flip a GraphicList?
i have 2 images in this graphic and there are not at zero zero both images are at different position
and i would like to flip them as a hole image is that possible ?
Is there a way to flip a GraphicList?
i have 2 images in this graphic and there are not at zero zero both images are at different position
and i would like to flip them as a hole image is that possible ?
Unfortunately, there’s no “quick” method to flipping all of the children of a Graphiclist
. I imagine the reason behind this is because some Graphic
s do not have the flipped
property (Stamp
for example). Here’s one way you should be able to go about flipping all of your Graphiclist
's children:
for each (var g:* in myGraphiclist.children)
{
if (g.hasOwnProperty("flipped")) g.flipped = true;
}
If you’re finding that you may need to use this more than once, consider adding the following setter to your Graphiclist.as (found in net.flashpunk.graphics).
/**
* Flips all of the Graphiclist's children, if possible.
*/
public function set flipped(b:Boolean):void
{
for each (var g:* in _graphics)
{
if (g.hasOwnProperty("flipped")) g.flipped = b;
}
}
And then simply calling myGraphiclist.flipped = true;
should do it!
How often are you calling the function? It shouldn’t be too bad so long as you’re not calling it every frame of an update loop. And flipping graphics doesn’t add to any performance woes as far as I know.