Tip of the Day – Flipping Display Objects

The tip that helped me the most lately is the with flipping objects with the help of matrices.

Here is the code:

function flip( display:DisplayObject, orientation:String ):void {
       var m:Matrix = display.transform.matrix;
       switch (orientation.toUpperCase()) {
               case "HORIZONTAL" :
                       m.a = -1;
                       m.tx = display.width + display.x;
               case "VERTICAL" :
                       m.d = -1;
                       m.ty = display.height + display.y;
       display.transform.matrix = m;
flip(logo, "horizontal");

This tip was provided by Sidney K. Thanks Sidney!

Related Posts

1 Comment

Sidney de Koning

about 7 years ago

Cool to see my tip on your site, thanks for placing :) Keep up the cool tips! Sid

Leave a Comment