在NativeWindow Adob​​e Air中绘制矩形

时间:2014-01-27 12:02:52

标签: actionscript-3 air drawing adobe flashdevelop

我是Adobe Air的新手。我想在新的实用程序窗口中绘制矩形。 我试过这段代码:

newSprite= new Sprite();
newSprite.x = 0;
newSprite.y = 0;
newSprite.graphics.beginFill(0x00ff00, 1);
newSprite.graphics.drawRect(-100, 0, 100, 100);
newSprite.graphics.endFill();
myNativeWindow.stage.addChild(newSprite);

问题是绿色矩形位于右侧。我不确定为什么?

enter image description here

1 个答案:

答案 0 :(得分:2)

尝试类似:

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

newSprite= new Sprite();
newSprite.x = 0;
newSprite.y = 0;
newSprite.graphics.beginFill(0x00ff00, 1);
//changing the x position just for testing purpose...
newSprite.graphics.drawRect(0, 0, 100, 100);
newSprite.graphics.endFill();
myNativeWindow.stage.addChild(newSprite);