电脑疯子技术论坛|电脑极客社区

微信扫一扫 分享朋友圈

已有 648 人浏览分享

FLV播放器全屏AS代码【源码】

 关闭 [复制链接]
648 0
  1. /**
  2. ---------------------------------

  3. 全屏模式控制
  4. ---------------------------------
  5. **/

  6. function setFullScreen() {
  7. //fscommand("fullscreen", true);
  8. if (_root.logoCoolRabbit._visible == false) {
  9. if (Stage["displayState"] == "normal") {
  10. fscommand("fullscreen", true);
  11. Stage["displayState"] = "fullScreen";
  12. } else if (Stage["displayState"] == "fullScreen") {
  13. fscommand("fullscreen", false);
  14. Stage["displayState"] = "normal";
  15. }
  16. rootWidth = Stage.width;
  17. rootHeight = Stage.height;

  18. //复位控制栏
  19. clearInterval(controlBuffCoolTime);
  20. controlBuffCoolTime = null;
  21. clearInterval(controlBuff);
  22. controlBuffCool = 0;
  23. controlBuffEstimate = null;

  24. //复位标题栏
  25. clearInterval(playTitleBuffCoolTime);
  26. playTitleBuffCoolTime = null;
  27. clearInterval(playTitleBuff);
  28. playTitleBuffCool = 0;
  29. playTitleBuffEstimate = null;

  30. //重新设置组件位置
  31. moduleSet();

  32. //重新计算和设置播放组件尺寸比
  33. videoWidthSet = rootWidth;
  34. videoHeightSet = videoHeight/videoWidth*rootWidth;
  35. playAllModule.playFlvWindow._width = videoWidthSet;
  36. playAllModule.playFlvWindow._height = videoHeightSet;
  37. playAllModule.playFlvWindow._y = (rootHeight-playAllModule.playFlvWindow._height)/2;
  38. }
  39. }

  40. //全屏模式切换
  41. playAllModule.controlSet.buttonFullScreen.onPress = function() {
  42. setFullScreen();
  43. };

  44. //创建右键全屏及退出全屏菜单
  45. //var newMenu:ContextMenu = new ContextMenu();
  46. var newMenu:ContextMenu = new ContextMenu(menuHandler);
  47. //隐藏右键的一些标准菜单
  48. newMenu.hideBuiltInItems();
  49. // 在右键菜单中加入菜单项
  50. //var fs:ContextMenuItem = new ContextMenuItem("全屏", goFullScreen);
  51. var fs:ContextMenuItem = new ContextMenuItem("全屏", setFullScreen);
  52. newMenu.customItems.push(fs);
  53. //var xfs:ContextMenuItem = new ContextMenuItem("退出全屏", exitFullScreen);
  54. var xfs:ContextMenuItem = new ContextMenuItem("退出全屏", setFullScreen);
  55. newMenu.customItems.push(xfs);
  56. // 现在将右键菜单指定给场景中的movieclip.我当前指定给场景中的box.你也可以指定给_root
  57. this.menu = newMenu;

  58. /**
  59. function goFullScreen() {
  60. //Stage["displayState"] = "fullScreen";
  61. }
  62. function exitFullScreen() {
  63. //Stage["displayState"] = "normal";
  64. }
  65. **/

  66. // 定义开启和关闭全屏功能,取决于你当前处于哪一种状态下
  67. function menuHandler(obj, menuObj) {
  68. if (Stage["displayState"] == "normal") {
  69. // 如果你当前处在正常模式下,则goFullscreen可点击
  70. menuObj.customItems[0].enabled = true;
  71. menuObj.customItems[1].enabled = false;
  72. } else {
  73. // 如果你当前片在全屏模式下,则exitFullScreen可点击
  74. menuObj.customItems[0].enabled = false;
  75. menuObj.customItems[1].enabled = true;
  76. }
  77. }
复制代码

您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

关注

23

粉丝

2901

主题
精彩推荐
热门资讯
网友晒图
图文推荐

Powered by Pcgho! X3.4

© 2008-2022 Pcgho Inc.