-
StackOverflow 文档
-
ActionScript 3 教程
-
响应式应用程序设计
-
基本响应应用程序
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
}
}
}