AS3 : stage.width vs stage.stageWidth
A number of times I have had to look up what the difference is between stage.width and stage.stageWidth in ActionScript 3. They can easily be confused because they are very similar. Basically stage.width is the total width for all the items on your stage and stage.stageWidth is the width of the swf canvas.
According to Adobe Docs
stage.width
Indicates the width of the display object, in pixels. The width is calculated based on the bounds of the content of the display object.
stage.stageWidth
Specifies the current width, in pixels, of the Stage.
When the value of the
According to Adobe Docs
stage.width
Indicates the width of the display object, in pixels. The width is calculated based on the bounds of the content of the display object.
stage.stageWidth
Specifies the current width, in pixels, of the Stage.
When the value of the
scaleMode property is set to StageScaleMode.NO_SCALE, the stageWidth property represents the width of Flash Player. This means that the stageWidth property varies as you resize the Flash Player window. When the value of the scaleMode property is not set to StageScaleMode.NO_SCALE, the stageWidth property represents the width of the SWF file as set during authoring in the Document Properties dialog box. This means that the value of the stageWidth property stays constant as you resize the Flash Player window. This property cannot be set. stage.width vs stage.stageWidth Demo
In the example below you can dynamically adjust the width of the box to see the difference between stage.width and stage.stageWidth. The stage.width will never be smaller than 234 because of the size of the toolbox at the bottom.



That was an incredible commentary. I came across your article and felt it exceptionally positive.
Reply to this