Flip a DisplayObject Vertical or Horizontal


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

just nice.


Copy this code and paste it in your HTML
  1. public function flipHorizontal(dsp:DisplayObject):void
  2. {
  3. var matrix:Matrix = dsp.transform.matrix;
  4. matrix.a=-1;
  5. matrix.tx=dsp.width+dsp.x;
  6. dsp.transform.matrix=matrix;
  7. }
  8.  
  9. public function flipVertical(dsp:DisplayObject):void
  10. {
  11. var matrix:Matrix = dsp.transform.matrix;
  12. matrix.d=-1;
  13. matrix.ty=dsp.height+dsp.y;
  14. dsp.transform.matrix=matrix;
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.