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

Example

The following example applies the Matrix object scaleMatrix to the Transform object trans. This Matrix scales the MovieClip rect by a factor of two.

import flash.geom.Transform;
import flash.geom.Matrix;

var rect:MovieClip = createRectangle(20, 80, 0xFF0000);

var trans:Transform = new Transform(rect);
trace(trans.matrix); // (a=1, b=0, c=0, d=1, tx=0, ty=0)
        
var scaleMatrix:Matrix = new Matrix();
scaleMatrix.scale(2, 2);

rect.onPress = function() {
    trans.matrix = scaleMatrix;
    trace(trans.matrix); // (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;
}

See also

Matrix (flash.geom.Matrix)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002300.html