Sunday, 12 September 2010

Flip movie clip in Actionscript 3

In this quick post I will show how to flip a movie clip horizontally or vertically using Actionscript 3 code. If you are using the Flash IDE you can flip a movie clip by selecting the Modify > Transform > Flip Horizontal/Vertical from the menu bar. To flip a movie clip with code you can use the following.

movieClipName.scaleX  *=-1; //horizontal
movieClipName.scaleY *=-1;  //vertical

You can also use the Matrix class to flip movie clips.
var matrix:Matrix = new Matrix();
matrix.translate((movieClipName.width + movieClipName.x)-movieClipName.width, movieClipName.y);
movieClipName.transform.matrix = matrix;

var matrix:Matrix = new Matrix();
matrix.translate(movieClipName.x, (movieClipName.height + movieClipName.y) - movieClipName.height);
movieClipName.transform.matrix = matrix


  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP