2014-01-27 188 views
0

我是Adobe Air的新手。我想在新的實用程序窗口中繪製矩形。 我試着用這個代碼:NativeWindow繪製矩形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

回答

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); 
+0

是的,謝謝你,我已經把TOP_RIGTH代替TOP_LEFT – Vlad

+0

歡迎您! :) – gabriel