Transform (flash.geom.Transform) 1269
Example
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;
}
matrix (Transform.matrix property)
public matrix : Matrix
A transformation Matrix object containing values that affect the scaling, rotation, and
translation of the movie clip.
Availability:
ActionScript 1.0; Flash Player 8
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...