宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应
您当前的位置: > 博客2 > AS2与AS3技术

[AS3]as3处理全屏事件详细说明附源代码

2016-10-13 00:16:48 点击量:20 标签: 收藏本文

[AS3]as3处理全屏事件详细说明附源代码

  1. /** 
  2. * Flash CS3中代码设置FlashPlayer全屏 actionScript3.0 player9 
  3. * @author xuechong 
  4. * @version 0.2 
  5. * @date 2011.02.21 - 2011.05.27 
  6. * */ 
  7.  
  8. /** 
  9. * 默认下Flash影片会居中显示。可以利用任何可视化对象的stage.align属性来重新设置电影的对齐方式。 
  10. * flash.display.StageAlign 类的属性: 
  11. * 这里没有水平和垂直都居中的模式,其实,默认模式就是它了, 
  12. * 但如果你改变了对其方式又想回到默认模式这时后只能传递空字符串""。 
  13. * Value Vertical alignment Horizontal 
  14. * StageAlign.TOP Top Center 
  15. * StageAlign.BOTTOM Bottom Center 
  16. * StageAlign.LEFT Center Left 
  17. * StageAlign.RIGHT Center Right 
  18. * StageAlign.TOP_LEFT Top Left 
  19. * StageAlign.TOP_RIGHT Top Right 
  20. * StageAlign.BOTTOM_LEFT Bottom Left 
  21. * StageAlign.BOTTOM_RIGHT Bottom Right 
  22. * */ 
  23.  
  24. import flash.display.Stage; 
  25. import flash.display.StageDisplayState; 
  26. import flash.events.FullScreenEvent; 
  27.  
  28. //btnID是可视对象或Flash cs中拖到画布上的原件 
  29. btnID.addEventListener(MouseEvent.CLICK, clickHander); 
  30.  
  31. function clickHander(event:MouseEvent):void{ 
  32. this.stage.displayState = StageDisplayState.FULL_SCREEN; 
    //cuplayer.com启动全屏幕 
  33. this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler); 
    //cuplayer.com监听FlashPlayer全屏模式事件 
  34.  
  35. function fullScreenHandler(event:FullScreenEvent):void{ 
  36. if(event.fullScreen == true){ //cuplayer.com提示如果当前是全屏模式 
  37. //trace("FlashPlayer全屏模式了"); 
  38. }else if(event.fullScreen == false){ //如果当前是一般模式 
  39. //trace("FlashPlayer还原模式了"); 
  40. this.stage.scaleMode = StageScaleMode.NO_SCALE; 
  41. //this.stage.align = StageAlign.TOP_RIGHT; 

 

ABOUT US
宜昌农人网络科技有限公司

我们是一家提供综合软件外包与弱电工程服务的技术公司。

业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。

公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室