AS3 - stage.width与stage.stageWidth的区别
作者:hangge | 2014-12-09 15:52
stage.stageWidth:指整个舞台的尺寸
stage.width:值舞台上所有元件摆放后的实际宽度。
比如下面的例子(stage.stageWidth是650,stage.width是150)
package
{
import flash.display.Sprite;
[SWF(width="650", height="270")]
public class StageTest extends Sprite
{
public function StageTest()
{
super();
this.graphics.beginFill(0x00ffff);
this.graphics.drawRect(50,50,150,150);
this.graphics.endFill();
trace(stage.stageWidth + " " + stage.width); //650 150
}
}
}
全部评论(0)