Friday, August 26, 2005

Flash® 8 - The Matrix and flash.geom.Transform

Flash® 8 contains a new intrinsic class called flash.geom.Transform that allows you to directly manipulate the view of any MovieClip at runtime. In the following example, we will use the flash.geom.Transform and flash.geom.Matrix to manipulate the IFBIN logo with some slider controls.



The sliders correspond to the "a", "b", "c", "d", "tx", "ty" properties of the flash.geom.Matrix class. When a slider is moved it creates a new Matrix and sets the value within the Transform class that is pointing to the logo MovieClip. The Transform class is very similar in functionality to the Color class in that it has an internal target as follows:

myTrans = new flash.geom.Transform( logo )


Once this is done, we can manipulate the Transform instance and the MovieClip will have its view modified. To set a new Matrix on the Transform you would do this:

myTrans.matrix = new flash.geom.Matrix(1,0,0,1,0,0)


The above matrix is set to zero manipulation and will return any MovieClip to the view contained within the Library. With those 6 points you can distort a clip to any feasible position. I will do a follow-up exploring the other aspects of Transform and Matrix.

This example will ship with full source and documentation within Flash® by Example.

Big IFBIN news on Monday! :)

Have a great weekend.

Ted ;)

0 Comments:

Post a Comment

<< Home