Package | flash.geom |
Class | public class Transform |
Inheritance | Transform ![]() |
Matrix
and/or a new ColorTransform
and setting the appropriate properties of the transform
property
of a display object.
See also
Property | Defined By | ||
---|---|---|---|
colorTransform : ColorTransform
A ColorTransform object containing values that universally adjust the colors in
the display object.
| Transform | ||
concatenatedColorTransform : ColorTransform
[read-only]
A ColorTransform object representing the combined color transformations applied to the display object
and all of its parent objects, back to the root level.
| Transform | ||
concatenatedMatrix : Matrix
[read-only]
A Matrix object representing the combined transformation matrixes of the
display object and all of its parent objects, back to the root level.
| Transform | ||
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance.
| Object | |
matrix : Matrix
A Matrix object containing values that affect the scaling, rotation,
and translation of the display object.
| Transform | ||
pixelBounds : Rectangle
[read-only]
A Rectangle object that defines the bounding rectangle of the display object on the Stage.
| Transform | ||
![]() | prototype : Object
[static]
A reference to the prototype object of a class or function object.
| Object |
colorTransform | property |
colorTransform:ColorTransform
[read-write] A ColorTransform object containing values that universally adjust the colors in the display object.
public function get colorTransform():ColorTransform
public function set colorTransform(value:ColorTransform):void
TypeError — The colorTransform is null when being set
|
See also
concatenatedColorTransform | property |
concatenatedColorTransform:ColorTransform
[read-only] A ColorTransform object representing the combined color transformations applied to the display object and all of its parent objects, back to the root level. If different color transformations have been applied at different levels, all of those transformations are concatenated into one ColorTransform object for this property.
public function get concatenatedColorTransform():ColorTransform
See also
concatenatedMatrix | property |
concatenatedMatrix:Matrix
[read-only] A Matrix object representing the combined transformation matrixes of the display object and all of its parent objects, back to the root level. If different transformation matrixes have been applied at different levels, all of those matrixes are concatenated into one matrix for this property.
public function get concatenatedMatrix():Matrix
matrix | property |
matrix:Matrix
[read-write] A Matrix object containing values that affect the scaling, rotation, and translation of the display object.
public function get matrix():Matrix
public function set matrix(value:Matrix):void
TypeError — The matrix is null when being set
|
See also
pixelBounds | property |
pixelBounds:Rectangle
[read-only] A Rectangle object that defines the bounding rectangle of the display object on the Stage.
public function get pixelBounds():Rectangle
TransformExample()
constructor creates a new sprite object target
.TransformExample()
constructor calls the draw()
method,
which draws a gradient square in the sprite.TransformExample()
constructor adds a click event listener for the sprite,
which is handled by the clickHandler()
method. clickHandler()
method creates a new Matrix object, skewMatrix
,
set to apply a skew affect. Another matrix, tempMatrix
, is assigned to the
current transformation matrix of the sprite, and then it is combined with the skewMatrix
using the concat()
method. This matrix is assigned to the assigned to the
transform.matrix
property of the square sprite. Each time the user clicks the square,
the call to the clickHandler()
modifies the shape of the square, by skewing it. clickHandler()
method creates a new ColorTransform object. The
redOffset
property of the new ColorTransform is set to the current value of redOffset and
incremented by 25. Likewise, the blueOffset
property is decremented by 25. With each click,
the colors of the sprite will change. package { import flash.display.Sprite; import flash.display.GradientType; import flash.geom.Matrix; import flash.geom.ColorTransform; import flash.events.MouseEvent; public class TransformExample extends Sprite { public function TransformExample() { var target:Sprite = new Sprite(); draw(target); addChild(target); target.useHandCursor = true; target.buttonMode = true; target.addEventListener(MouseEvent.CLICK, clickHandler) } public function draw(sprite:Sprite):void { var red:uint = 0xFF0000; var green:uint = 0x00FF00; var blue:uint = 0x0000FF; var size:Number = 100; sprite.graphics.beginGradientFill(GradientType.LINEAR, [red, blue, green], [1, 0.5, 1], [0, 200, 255]); sprite.graphics.drawRect(0, 0, 100, 100); } public function clickHandler(event:MouseEvent):void { var skewMatrix:Matrix = new Matrix(); skewMatrix.c = 0.25; var tempMatrix:Matrix = this.transform.matrix; tempMatrix.concat(skewMatrix); this.transform.matrix = tempMatrix; var rOffset:Number = this.transform.colorTransform.redOffset + 25; var bOffset:Number = this.transform.colorTransform.blueOffset - 25; this.transform.colorTransform = new ColorTransform(1, 1, 1, 1, rOffset, 0, bOffset, 0); } } }