stage.width vs. stage.stageWidth in Actionscript 3
Careful with this one. It’s easy to miss if you’re accustomed to Actionscript 1 or 2.
stage.width will return the width of the content on the stage and ignore any empty pixels around the edges. So if you only have a 100 px wide rectangle on stage, your stage.width will be 100.
stage.stageWidth will give you the size of the stage, more like Stage.width in Actionscript 2. Use stage.stageWidth if you’re trying to position elements relative to the stage.
Same goes for stage.height and stage.stageHeight.





Good post. This is stage.wdith vs stage.Stagewidth can def be tricky.
Comment by Mike — May 28, 2009 @ 2:59 pm
Great job, thank you for sharing.
Comment by Sharedtut — February 3, 2010 @ 4:22 pm