Posted By

arpit on 12/21/09


Tagged

DisplayObject


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Demian
adrianparr


Flipping a DisplayObject


 / Published in: ActionScript 3
 

URL: http://blog.natebeck.net/2009/02/tip-of-the-day-flipping-display-objects/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+NateBeck+%28Nate+Beck%29

  1. function flip( display:DisplayObject, orientation:String ):void {
  2.  
  3. var m:Matrix = display.transform.matrix;
  4.  
  5. switch (orientation.toUpperCase()) {
  6.  
  7. case "HORIZONTAL" :
  8. m.a = -1;
  9. m.tx = display.width + display.x;
  10. break;
  11. case "VERTICAL" :
  12. m.d = -1;
  13. m.ty = display.height + display.y;
  14. break;
  15. }
  16. display.transform.matrix = m;
  17. }
  18.  
  19. flip(logo, "horizontal");

Report this snippet  

You need to login to post a comment.