本文共 1298 字,大约阅读时间需要 4 分钟。
/**
* Flash CS3中代码设置FlashPlayer全屏 actionScript3.0 player9 * @author xuechong * @version 0.2 * @date 2011.02.21 - 2011.05.27 * *//**
* 默认下Flash影片会居中显示。可以利用任何可视化对象的stage.align属性来重新设置电影的对齐方式。 * flash.display.StageAlign 类的属性: * 这里没有水平和垂直都居中的模式,其实,默认模式就是它了, * 但如果你改变了对其方式又想回到默认模式这时后只能传递空字符串""。 * Value Vertical alignment Horizontal * StageAlign.TOP Top Center * StageAlign.BOTTOM Bottom Center * StageAlign.LEFT Center Left * StageAlign.RIGHT Center Right * StageAlign.TOP_LEFT Top Left * StageAlign.TOP_RIGHT Top Right * StageAlign.BOTTOM_LEFT Bottom Left * StageAlign.BOTTOM_RIGHT Bottom Right * */import flash.display.Stage;
import flash.display.StageDisplayState;import flash.events.FullScreenEvent;//btnID是可视对象或Flash cs中拖到画布上的原件
btnID.addEventListener(MouseEvent.CLICK, clickHander);function clickHander(event:MouseEvent):void{
this.stage.displayState = StageDisplayState.FULL_SCREEN; //启动全屏幕 this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler); //监听FlashPlayer全屏模式事件}function fullScreenHandler(event:FullScreenEvent):void{
if(event.fullScreen == true){ //如果当前是全屏模式 //trace("FlashPlayer全屏模式了"); }else if(event.fullScreen == false){ //如果当前是一般模式 //trace("FlashPlayer还原模式了"); } this.stage.scaleMode = StageScaleMode.NO_SCALE; //this.stage.align = StageAlign.TOP_RIGHT;}转载地址:http://kogxi.baihongyu.com/