flex web 全屏 例子 不确定 ria

本文介绍了一种使用ActionScript 3.0实现Flash应用程序在全屏模式与普通模式之间切换的方法。通过监听FullScreenEvent事件并根据不同的显示状态进行相应的操作,可以实现平滑的全屏模式切换。

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init(event)">

<mx:Script>

<![CDATA[

import flash.display.StageDisplayState;

private function init(evt:Event):void {

/* Set up full screen handler. */

Application.application.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);

dispState = Application.application.stage.displayState;

}

private function fullScreenHandler(evt:FullScreenEvent):void {

dispState = Application.application.stage.displayState + " (fullScreen=" + evt.fullScreen.toString() + ")";

if (evt.fullScreen) {

/* Do something specific here if we switched to full screen mode. */

} else {

/* Do something specific here if we switched to normal mode. */

}

}

private function toggleFullScreen():void {

try {

switch (Application.application.stage.displayState) {

case StageDisplayState.FULL_SCREEN:

/* If already in full screen mode, switch to normal mode. */

Application.application.stage.displayState = StageDisplayState.NORMAL;

break;

default:

/* If not in full screen mode, switch to full screen mode. */

Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;

break;

}

} catch (err:SecurityError) {

// ignore

}

}

]]>

</mx:Script>

<mx:String id="dispState" />

<mx:Label text="width={Application.application.width}" />

<mx:Label text="height={Application.application.height}" />

<mx:Label text="displayState={dispState}" />

<mx:Button label="Toggle fullscreen" click="toggleFullScreen()" />

</mx:Application>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

 

 

Served from: blog.minidx.com @ 2011-01-27 14:37:50 -->

评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值