//指定整个Flash应用程序的大小固定,无缩放
stage.scaleMode = StageScaleMode.NO_SCALE;
//指定靠左上角对齐
stage.align = StageAlign.TOP_LEFT;
//获取并设置舞台的帧频
stage.frameRate = 30;
//隐藏上下文菜单中的默认项
stage.showDefaultContextMenu = false;
//呈现最佳品质
stage.quality = StageQuality.BEST;
//事件
//Flash Player获得操作系统焦点并变为活动状态时调度
stage.addEventListener(Event.ACTIVATE, activateHandler);
//当Stage对象的scaleMode属性设置为StageScaleMode.NO_SCALE且SWF文件大小经过重新调整时进行调度
stage.addEventListener(Event.RESIZE, resizeHandler);
//开启双击
stage.doubleClickEnabled = true;
//双击事件
stage.addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
function activateHandler(event:Event):void {
trace("获取焦点: " + event);
}
function resizeHandler(event:Event):void {
trace("改变舞台大小: " + event + " 宽:" + stage.stageWidth + "高:" + stage.stageHeight);
}
//双击全屏显示
//此功能在浏览器中不可用
var myfullscreen:Boolean;
function doubleClickHandler(event:Event):void {
trace("双击事件: " + event);
if (myfullscreen) {
myfullscreen = false;
stage.displayState = StageDisplayState.NORMAL;
} else {
myfullscreen = true;
stage.displayState = StageDisplayState.FULL_SCREEN;
}
}