开发者

Flash stage/root width & height always 100?

开发者 https://www.devze.com 2023-03-26 18:04 出处:网络
trace(root.width); trace(stage.width); Both these return 100. Same for height. The stage has been set to 1024x620 in the editor.
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

0

精彩评论

暂无评论...
验证码 换一张
取 消