Mine
public text v1 · immutableprivate function onResizeHandler(){
var stageAspectRatio:Number = Stage.width / Stage.height;
if(stageAspectRatio > _aspectRatio){
this._width = Stage.width;
this._height = Stage.width / _aspectRatio;
this._x = 0;
this._y = - (this._height - Stage.height) / 2
} else {
this._height = Stage.height;
this._width = Stage.height * _aspectRatio;
this._x = - (this._width - Stage.width) / 2
this._y = 0;
}
}