trace(root.width);
trace(stage.width);
Both these return 100. Same for height. The stage has been set to 1024x620 in the editor.
I'm using CS5, Flash version 10, windows7 64-bit.
I don't get what's going wrong here. I'm trying to center something and it开发者_运维问答 keeps coming out like this.
You should be using stage.stageWidth
to get the actual width of the stage. stage.width
is returning the width of the bounding box of stage, which will only be as large as the content you attach to it.
Note: if you don't set the scaleMode of stage to 'noScale', stage.stageWidth
will always return the initial stage size, regardless of any resizing.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Stage.html#stageWidth
精彩评论