Domanda

I am new to Adobe Air. I wanted to draw rectangles in a new utility window. I tried with this code:

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

The problem is the green rectangle is far on the right side. I am not sure why?

enter image description here

È stato utile?

Soluzione

Try something like:

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);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top