User Guide

Transform (flash.geom.Transform) 1271
Example
The following example creates a Transform object
trans and traces out its pixelBounds
property. Notice that
pixelBounds returns a bounding box with values equal to the
MovieClip object's
getBounds() and getRect() methods.
import flash.geom.Transform;
var rect:MovieClip = createRectangle(20, 80, 0xFF0000);
var trans:Transform = new Transform(rect);
trace(trans.pixelBounds); // (x=0, y=0, w=20, h=80)
var boundsObj:Object = rect.getBounds();
trace(boundsObj.xMin); // 0
trace(boundsObj.yMin); // 0
trace(boundsObj.xMax); // 20
trace(boundsObj.yMax); // 80
var rectObj:Object = rect.getRect();
trace(rectObj.xMin); // 0
trace(rectObj.yMin); // 0
trace(rectObj.xMax); // 20
trace(rectObj.yMax); // 80
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;
}
Transform constructor
public Transform(mc:MovieClip)
Creates a new Transform object attached to the given MovieClip object.
When it is created the new Transform object can be retrieved by getting the
transform
property of the given MovieClip object.
Availability: ActionScript 1.0; Flash Player 8
Parameters
mc:MovieClip - The MovieClip object to which the new Transform object is applied.