Flipping a DisplayObject


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  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");

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.