width property
Indicates the width of the display object, in dp.
The width
is calculated based on the bounds of the content of the
display object.
When you set the width
property, the scaleX
property is adjusted
accordingly, as shown in the following code:
var rect:Shape = new Shape();
rect.graphics.beginFill(0xFF0000);
rect.graphics.drawRect(0, 0, 100, 100);
trace(rect.scaleX) // 1;
rect.width = 200;
trace(rect.scaleX) // 2;
A display object with no content (such as an empty sprite) has a width of 0, even if you try to set width to a different value.
Implementation
@override
double get width {
throw 'Use `stage.stageWidth` instead.';
}