2012年6月8日 星期五

flash.events.FullScreenEvent

flash.events.FullScreenEvent
import flash.events.FullScreenEvent;
import flash.events.FullScreenEvent;
import flash.events.MouseEvent;
import flash.display.StageDisplayState;
import flash.display.StageScaleMode;

this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.toNormalScreenBtn.visible = false;

this.stage.addEventListener(Event.FULLSCREEN,fullScreenEventHandler);
this.toFullScreenBtn.addEventListener(MouseEvent.CLICK,toFullScreenHandler);
this.toNormalScreenBtn.addEventListener(MouseEvent.CLICK,toNormalScreenHandler);

function toFullScreenHandler(event:MouseEvent):void{
 this.stage.displayState = StageDisplayState.FULL_SCREEN ;
 return;
}

function toNormalScreenHandler(event:MouseEvent):void{
 this.stage.displayState = StageDisplayState.NORMAL ;
 return;
}

function fullScreenEventHandler(event:FullScreenEvent):void{
 this.info.text = "event.fullScreen : " + event.fullScreen;
 switch(event.fullScreen){
  case true:
   this.toFullScreenBtn.visible = false;
   this.toNormalScreenBtn.visible = true;
  break;
  case false:
   this.toFullScreenBtn.visible = true;
   this.toNormalScreenBtn.visible = false;
  break;
  default:
  break;
 }
 return;
}