
Код AS3:
public class Test extends Sprite {
public function Test() {
super.stage.scaleMode = StageScaleMode.NO_SCALE;
super.stage.align = StageAlign.TOP_LEFT;
this._ball = new Shape();
with (this._ball.graphics) {
lineStyle(0, 0, 0);
beginFill(0);
drawCircle(50, 50, 50);
endFill();
}
super.addChild(this._ball);
this._ball.x = (super.stage.stageWidth-this._ball.width)>>1;
this._ball.y = (super.stage.stageHeight-this._ball.height)>>1;
super.stage.addEventListener(Event.RESIZE, this.handler_stageResize);
}
private var _ball:Shape;
private function handler_stageResize(event:Event):void {
this._ball.x = (super.stage.stageWidth-this._ball.width)>>1;
this._ball.y = (super.stage.stageHeight-this._ball.height)>>1;
}
}