ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > Transform (flash.geom.Transform) > concatenatedMatrix (Transform.concatenatedMatrix property) | |||
public concatenatedMatrix : Matrix [read-only]
A Matrix object representing the combined transformation matrixes of this object and all of its parent objects, back to the root level. If different transformation matrixes have been applied at different levels, each of those matrixes will be concatenated into one matrix for this property.
Availability: ActionScript 1.0; Flash Player 8
The following example applies two Transform objects to both a child and parent MovieClip object. A scaleMatrix is then applied to the Transform object parentTrans, which scales both parent and child MovieClip objects. You can see how child.concatenatedMatrix is the combination of parentTrans and childTrans.
import flash.geom.Transform;
import flash.geom.Matrix;
var parentRect:MovieClip = createRectangle(20, 80, 0xFF0000);
var childRect:MovieClip = createRectangle(10, 40, 0x00FF00, parentRect);
var parentTrans:Transform = new Transform(parentRect);
var childTrans:Transform = new Transform(childRect);
var scaleMatrix:Matrix = new Matrix();
scaleMatrix.scale(2, 2);
parentTrans.matrix = scaleMatrix;
trace(childTrans.concatenatedMatrix); // (a=2, b=0, c=0, d=2, tx=0, ty=0)
trace(childTrans.matrix); // (a=1, b=0, c=0, d=1, tx=0, ty=0)
trace(parentTrans.concatenatedMatrix); // (a=2, b=0, c=0, d=2, tx=0, ty=0)
function createRectangle(width:Number, height:Number, color:Number, scope:MovieClip):MovieClip {
scope = (scope == undefined) ? this : scope;
var depth:Number = scope.getNextHighestDepth();
var mc:MovieClip = scope.createEmptyMovieClip("mc_" + depth, depth);
mc.beginFill(color);
mc.lineTo(0, height);
mc.lineTo(width, height);
mc.lineTo(width, 0);
mc.lineTo(0, 0);
return mc;
}
|
|
|
|