Example
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
public class Main extends Sprite
{
//Document Class Main Constructor
public function Main()
{
//Sometimes stage isn't available yet, so if not, wait for it before proceeding
if (!stage) {
addEventListener(Event.ADDED_TO_STAGE, stageReady);
}else {
stageReady();
}
}
protected function stageReady(e:Event = null):void {
//align the stage to the top left corner of the window/container
stage.align = StageAlign.TOP_LEFT;
//don't scale the content when the window resizes
stage.scaleMode = StageScaleMode.NO_SCALE;
//listen for when the window is resized
stage.addEventListener(Event.RESIZE, stageResized);
}
protected function stageResized(e:Event):void {
//use stage.stageWdith & stage.stageHeight to repostion and resize items
}
}
}