加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

FlexPaper使用小记

发布时间:2020-12-15 01:41:53 所属栏目:百科 来源:网络整理
导读:?xml?version= "1.0" ?encoding= "utf-8" ??? mx:Application?xmlns:mx= "http://www.adobe.com/2006/mxml" ?? ????????????????xmlns:fp= "com.devaldi.controls.flexpaper.*" ?? ????????????????layout= "absolute" ?width= "100%" ?height= "100%" ??? ?

  1. <?xml?version="1.0"?encoding="utf-8"?>??
  2. <mx:Application?xmlns:mx="http://www.adobe.com/2006/mxml"??
  3. ????????????????xmlns:fp="com.devaldi.controls.flexpaper.*"??
  4. ????????????????layout="absolute"?width="100%"?height="100%"???
  5. ????????????????applicationComplete="initApp();">??
  6. ??????
  7. ????<mx:Script>??
  8. ????????<![CDATA[??
  9. ????????????import?mx.controls.Alert;??
  10. ??????????????
  11. ????????????public?var?_aid?=?0;//文档ID??
  12. ??????????????
  13. ????????????[Bindable]??
  14. ????????????public?var?_Scale:Number?=?1;//缩放比例??
  15. ??????????????
  16. ????????????[Bindable]??
  17. ????????????public?var?_SwfFile:String?=?"";//SWF文件路径??
  18. ??????????????
  19. ????????????[Bindable]??
  20. ????????????public?var?_ZoomTransition:String?=?"eaSEOut";??
  21. ??????????????
  22. ????????????[Bindable]??
  23. ????????????public?var?_ZoomTime:Number?=?0.6;??
  24. ??????????????
  25. ????????????[Bindable]??
  26. ????????????public?var?_ZoomInterval:Number?=?0.1;??
  27. ??????????????
  28. ????????????[Bindable]??
  29. ????????????public?var?_FitPageOnLoad:Boolean?=?false;//加载后适合高度??
  30. ??????????????
  31. ????????????[Bindable]??
  32. ????????????public?var?_FitWidthOnLoad:Boolean?=?false;//加载后适合宽度??
  33. ??????????????
  34. ????????????[Bindable]??
  35. ????????????public?var?_PrintEnabled:Boolean?=?true;//是否支持打印??
  36. ??????????????
  37. ????????????[Bindable]??
  38. ????????????public?var?_FullScreenAsMaxWindow:Boolean?=?false;//是否支付全屏??
  39. ??????????????
  40. ????????????[Bindable]??
  41. ????????????public?var?_ProgressiveLoading:Boolean?=?false;//是否延迟加载??
  42. ??????????????
  43. ????????????[Bindable]??
  44. ????????????public?var?_localeChain:String?=?"zh_CN";//语言??
  45. ??????????????
  46. ????????????private?var?isFocus:Boolean?=?false;??
  47. ??????????????
  48. ????????????//初始化参数??
  49. ????????????private?function?initApp():void{??
  50. ????????????????var?params:Object?=?Application.application.parameters;??
  51. ????????????????_Scale?=?getNumber(params,?"Scale",?1);??
  52. ????????????????_SwfFile?=?getString(params,?"SwfFile",?"Paper.swf");??
  53. ????????????????_ZoomTransition?=?getString(params,?"ZoomTransition",?"eaSEOut");??
  54. ????????????????_ZoomTime?=?getNumber(params,?"ZoomTime",?0.6);??
  55. ????????????????_ZoomInterval?=?getNumber(params,?"ZoomInterval",?0.1);??
  56. ????????????????_FitPageOnLoad?=?getBoolean(params,?"FitPageOnLoad",?false);??
  57. ????????????????_FitWidthOnLoad?=?getBoolean(params,?"FitWidthOnLoad",?false);??
  58. ????????????????_PrintEnabled?=?getBoolean(params,?"PrintEnabled",?true);??
  59. ????????????????_FullScreenAsMaxWindow?=?getBoolean(params,?"FullScreenAsMaxWindow",?false);??
  60. ????????????????_ProgressiveLoading?=?getBoolean(params,?"ProgressiveLoading",?true);??
  61. ????????????????_localeChain?=?params["localeChain"];??
  62. ??????????????????
  63. ????????????????//注册事件监听??
  64. ????????????????this.addEventListener(MouseEvent.MOUSE_OVER,?onMouSEOver);??
  65. ????????????????this.addEventListener(MouseEvent.MOUSE_OUT,?onMouSEOut);??
  66. ??????????????????
  67. ????????????????//开放给外部(javascript)调用??
  68. ????????????????ExternalInterface.addCallback("hasFocus",?hasFocus);??
  69. ????????????????//ExternalInterface.addCallback("focus",?focus);??
  70. ????????????????ExternalInterface.addCallback("setViewerFocus",?setViewerFocus);??????
  71. ????????????}??
  72. ??????????????
  73. ??????????????
  74. ??????????????
  75. ????????????private?function?onMouSEOver(event:MouseEvent):void{??
  76. ????????????????this.isFocus?=?true;??
  77. ????????????}??
  78. ??????????????
  79. ????????????private?function?onMouSEOut(event:MouseEvent):void{??
  80. ????????????????this.isFocus?=?false;??
  81. ????????????}??
  82. ??????????????
  83. ????????????public?function?hasFocus():Boolean{??
  84. ????????????????//Alert.show("hasFocus");??
  85. ????????????????return?isFocus;??
  86. ????????????}??
  87. ??????????????
  88. ????????????public?function?setViewerFocus(isFocus:Boolean):void{??
  89. ????????????????//Alert.show("setViewerFocus");??
  90. ????????????????this.paperViewer.setViewerFocus();??
  91. ????????????}??
  92. ??????????????
  93. ????????????/**?
  94. ?????????????*??
  95. ?????????????*?获取String类型参数?
  96. ?????????????*?如果没有,则返回默认值?
  97. ?????????????**/??
  98. ????????????private?function?getString(params:Object,?name:String,?def:String):String{??
  99. ????????????????if(params[name]?!=?null){??
  100. ????????????????????return?params[name];??
  101. ????????????????}??
  102. ????????????????return?def;??
  103. ????????????}??
  104. ??????????????
  105. ????????????private?function?getNumber(params:Object,?def:Number):Number{??
  106. ????????????????if(params[name]?!=?null){??
  107. ????????????????????return?params[name];??
  108. ????????????????}??
  109. ????????????????return?def;??
  110. ????????????}??
  111. ??????????????
  112. ????????????private?function?getBoolean(params:Object,?def:Boolean):Boolean{??
  113. ????????????????//Alert.show("比较:"+name);??
  114. ????????????????if(params[name]?!=?null){??
  115. ????????????????????return?params[name]?==?"true";??
  116. ????????????????}??
  117. ????????????????return?def;??
  118. ????????????}??
  119. ????????]]>??
  120. ????</mx:Script>??
  121. ????<!--mx:Panel?x="165"?y="76"?width="250"?height="200"?layout="absolute"?title="一个人">??
  122. ????<mx:Label?x="59"?y="37"?text="{Scale}"?width="88"/>??
  123. ????</mx:Panel-->??
  124. ??????
  125. ????<fp:FlexPaperViewer?id="paperViewer"??
  126. ????????width="100%"???
  127. ????????height="100%"???
  128. ????????Scale="{_Scale}"???
  129. ????????SwfFile="{_SwfFile}"???
  130. ????????ZoomTransition="{_ZoomTransition}"???
  131. ????????ZoomTime="{_ZoomTime}"???
  132. ????????ZoomInterval="{_ZoomInterval}"??
  133. ????????FitPageOnLoad="{_FitPageOnLoad}"??
  134. ????????FitWidthOnLoad="{_FitWidthOnLoad}"??
  135. ????????PrintEnabled="{_PrintEnabled}"??
  136. ????????FullScreenAsMaxWindow="{_FullScreenAsMaxWindow}"??
  137. ????????ProgressiveLoading="{_ProgressiveLoading}"?/>??
  138. </mx:Application> ?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读