Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Transform (flash.geom.Transform) > pixelBounds (Transform.pixelBounds property) | |||
public pixelBounds : Rectangle
A Rectangle object that defines the bounding rectangle of the MovieClip object on the Stage.
Availability: ActionScript 1.0; Flash Player 8
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;
}
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/00002301.html