Flipping objects with a Matrix


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



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

Report this snippet


Comments


You need to login to view comments.