FLEX全屏显示


全屏显示,第一种写法:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
global{
font-size:19;
}
</fx:Style>
<fx:Script>
<![CDATA[

import mx.controls.Alert;
private function fullScr():void{
stage.displayState=StageDisplayState.FULL_SCREEN;
//controlScr.label="普通";
//controlScr.addEventListener(MouseEvent.CLICK, normalScr);
var contextMenu:ContextMenu=new ContextMenu();
contextMenu.hideBuiltInItems();
var item:ContextMenuItem=new ContextMenuItem("ydq");
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,alertMsg);
contextMenu.customItems.push(item);
this.contextMenu=contextMenu;
}

private function alertMsg(event:ContextMenuEvent):void{
Alert.show("hacker.Ye");
}

private function normalScr():void{
//controlScr.removeEventListener(MouseEvent.CLICK,fullScr);
stage.displayState=StageDisplayState.NORMAL;
}

]]>
</fx:Script>

<mx:Button label="全屏" click="fullScr();"/>
<mx:Button label="普通" click="normalScr()" x="86" y="0"/>

<mx:Image source="../WebContent/image/fullscreen.jpg" mouseDown="fullScr();" x="0" y="47" height="25"/>
<mx:Image source="../WebContent/image/nofull.jpg" mouseDown="normalScr()" x="96" y="47"/>

</s:Application>



全屏显示,第二种写法:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
applicationComplete="init()">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;

protected function init():void{
this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenChange);
}

private function toggleFullScreen():void{
if(stage.displayState==StageDisplayState.NORMAL){
stage.displayState=StageDisplayState.FULL_SCREEN;
}else{
stage.displayState=StageDisplayState.NORMAL;
}
}

protected function fullScreenChange(event:FullScreenEvent):void{
if( this.stage.displayState == StageDisplayState.FULL_SCREEN ){
full.source="/FlexFullScreen/image/nofull.jpg";
full.toolTip="普通显示";
} else{
full.source="/FlexFullScreen/image/fullscreen.jpg";
full.toolTip="全屏显示";
}
}

]]>
</fx:Script>

<!--全屏图标-->
<mx:Image id="full" source="/FlexFullScreen/image/fullscreen.jpg" mouseDown="toggleFullScreen()" top="2" left="2" buttonMode="true" toolTip="全屏显示"/>

</s:Application>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值