1、如创建 ceshi Flex项目 ,把下面代码覆盖项目ceshi.mxml文件
<?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%" applicationComplete="initApp();"> <mx:Metadata> [ResourceBundle("FlexPaper")] [Event(name="onDocumentLoaded", type="com.devaldi.events.DocumentLoadedEvent")] [Event(name="onLoadingProgress", type="flash.events.ProgressEvent")] [Event(name="onDocumentLoadedError", type="flash.events.ErrorEvent")] [Event(name="onCurrPageChanged", type="com.devaldi.events.CurrentPageChangedEvent")] [Event(name="onDocumentLoading", type="flash.events.Event")] [Event(name="onExternalLinkClicked", type="com.devaldi.events.ExternalLinkClickedEvent")] [Event(name="onDocumentPrinted", type="com.devaldi.events.DocumentPrintedEvent")] [Event(name="onPageLoaded", type="com.devaldi.events.PageLoadedEvent")] [Event(name="onPageLoading", type="com.devaldi.events.PageLoadingEvent")] [Event(name="onErrorLoadingPage", type="com.devaldi.events.ErrorLoadingPageEvent")] </mx:Metadata> <mx:Script> <![CDATA[ import mx.controls.Alert; import com.devaldi.events.CurrentPageChangedEvent; import com.devaldi.events.CursorModeChangedEvent; import com.devaldi.events.DocumentLoadedEvent; import com.devaldi.events.DocumentPrintedEvent; import com.devaldi.events.ErrorLoadingPageEvent; import com.devaldi.events.ExternalLinkClickedEvent; import com.devaldi.events.FitModeChangedEvent; import com.devaldi.events.ScaleChangedEvent; import com.devaldi.events.ViewModeChangedEvent; public var _aid:Number = 0;//文档ID [Bindable] public var _Scale:Number = 1;//缩放比例 [Bindable] public var _EncodeURI:Boolean = true; [Bindable] public var _SwfFile:String = "";//SWF文件路径 [Bindable] public var _ZoomTransition:String = "easeOut"; [Bindable] public var _ZoomTime:Number = 0.6; [Bindable] public var _ZoomInterval:Number = 0.1; [Bindable] public var _MinZoomSize:Number = 0.3; [Bindable] public var _MaxZoomSize:Number = 5; [Bindable] public var _FitPageOnLoad:Boolean = false;//加载后适合高度 [Bindable] public var _FitWidthOnLoad:Boolean = false;//加载后适合宽度 [Bindable] public var _PrintEnabled:Boolean = true;//是否支持打印 [Bindable] public var _FullScreenAsMaxWindow:Boolean = false;//是否支付全屏 [Bindable] public var _ProgressiveLoading:Boolean = false;//是否延迟加载 [Bindable] public var _localeChain:String = "zh_CN";//语言 private var isFocus:Boolean = false; //------------------------ [Bindable] public var _SearchMatchAll:Boolean = true; [Bindable] public var _PrintPaperAsBitmap:Boolean = false; [Bindable] public var _ViewModeToolsVisible:Boolean = true; [Bindable] public var _ZoomToolsVisible:Boolean = true; [Bindable] public var _NavToolsVisible:Boolean = true; [Bindable] public var _CursorToolsVisible:Boolean = true; [Bindable] public var _SearchToolsVisible:Boolean = true; //初始化参数 private function initApp():void{ var params:Object = Application.application.parameters; _Scale = getNumber(params, "Scale", 1); _SwfFile = getString(params, "SwfFile", "Paper.swf"); _EncodeURI = getNumber(params, "EncodeURI", 1); _ZoomTransition = getString(params, "ZoomTransition", "easeOut"); _ZoomTime = getNumber(params, "ZoomTime", 0.6); _MinZoomSize = getNumber(params, "MinZoomSize", 0.2); _MaxZoomSize = getNumber(params, "MaxZoomSize", 5); _ZoomInterval = getNumber(params, "ZoomInterval", 0.1); _FitPageOnLoad = getBoolean(params, "FitPageOnLoad", false); _FitWidthOnLoad = getBoolean(params, "FitWidthOnLoad", false); _PrintEnabled = getBoolean(params, "PrintEnabled", true); _FullScreenAsMaxWindow = getBoolean(params, "FullScreenAsMaxWindow", false); _ProgressiveLoading = getBoolean(params, "ProgressiveLoading", true); _localeChain = params["localeChain"]; _SearchMatchAll=getBoolean(params, "SearchMatchAll", true); _PrintPaperAsBitmap=getBoolean(params, "PrintPaperAsBitmap", false); _ViewModeToolsVisible=getBoolean(params, "ViewModeToolsVisible", true); _ZoomToolsVisible=getBoolean(params, "ZoomToolsVisible", true); _NavToolsVisible=getBoolean(params, "NavToolsVisible", true); _CursorToolsVisible=getBoolean(params, "CursorToolsVisible", true); _SearchToolsVisible=getBoolean(params, "SearchToolsVisible", true); //注册事件监听 this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); this.addEventListener(MouseEvent.CLICK,setFocusTo); this.addEventListener("onPageLoaded",pageLoadedEventHandler); //开放给外部(javascript)调用 ExternalInterface.addCallback("hasFocus", hasFocus); ExternalInterface.addCallback("setViewerFocus", setViewerFocus); ExternalInterface.addCallback("gotoPage", gotoPage); ExternalInterface.addCallback("fitWidth", fitWidth); ExternalInterface.addCallback("fitHeight", fitHeight); ExternalInterface.addCallback("loadSwf", loadSwf); ExternalInterface.addCallback("printPaperRange", printPaperRange); ExternalInterface.addCallback("searchText", searchText); ExternalInterface.addCallback("prevSearchMatch", prevSearchMatch); ExternalInterface.addCallback("nextSearchMatch", nextSearchMatch); ExternalInterface.addCallback("switchMode", switchMode); ExternalInterface.addCallback("Zoom", Zoom); ExternalInterface.addCallback("nextPage", nextPage); ExternalInterface.addCallback("getCurrPage", getCurrPage); ExternalInterface.addCallback("prevPage", prevPage); ExternalInterface.addCallback("printPaper", printPaper); ExternalInterface.addCallback("getTotalPages", getTotalPages); } //---------------------------事件------------------------------ protected function onLoadedError(event:ErrorEvent):void{ dispatchEvent(event); } private function setFocusTo(e:MouseEvent):void{ stage.stageFocusRect = false; stage.focus = e.target as InteractiveObject; } private function onMouseOver(event:MouseEvent):void{ this.isFocus = true; } private function onMouseOut(event:MouseEvent):void{ this.isFocus = false; } protected function onCurrPageChanged(event:CurrentPageChangedEvent):void{ dispatchEvent(event); } protected function documentLoadedErrorHandler(event:Event):void{ dispatchEvent(event); } protected function onExternalLinkClickedHandler(event:ExternalLinkClickedEvent):void{ dispatchEvent(event); } protected function onDocumentLoadingProgressHandler(event:ProgressEvent):void{ dispatchEvent(event); } protected function papersLoadingHandler(event:Event):void{ dispatchEvent(event); } protected function pageLoadingEventHandler(event:Event):void{ dispatchEvent(event); } protected function documentPrintedHandler(event:DocumentPrintedEvent):void{ dispatchEvent(event); } protected function documentLoadedHandler(event:Event):void{ dispatchEvent(event); } protected function pageLoadedEventHandler(event:Event):void{ dispatchEvent(event); } protected function errorLoadingPageEventHandler(event:ErrorLoadingPageEvent):void{ dispatchEvent(event); } //----------------------------函数----------------------------- public function getTotalPages():Number{ return FlexPaper.getTotalPages(); } public function printPaper(e:Event):void{ FlexPaper.printPaper(e); } public function printPaperRange(range:String):void{ FlexPaper.printPaperRange(range); } public function searchText(text:String):void{ FlexPaper.searchText(text); } public function prevSearchMatch():void{ FlexPaper.prevSearchMatch(); } public function nextSearchMatch(text:String):void{ FlexPaper.nextSearchMatch(text); } public function switchMode(mode:String=null):void{ FlexPaper.switchMode(mode); } public function Zoom(factor:Number):void{ FlexPaper.Zoom(factor); } public function nextPage():void{ FlexPaper.nextPage(); } public function prevPage():void{ return FlexPaper.prevPage(); } public function getCurrPage():Number{ return FlexPaper.getCurrPage(); } public dynamic function loadSwf(s:String):void{ FlexPaper.SwfFile = s; } public function fitHeight():void{ FlexPaper.fitHeight(); } public function fitWidth():void{ FlexPaper.fitWidth(); } public function gotoPage(p:Number):void{ FlexPaper.gotoPage(p); } public function hasFocus():Boolean{ return isFocus; } public function setViewerFocus(isFocus:Boolean):void{ this.FlexPaper.setViewerFocus(); } /** * * 获取String类型参数 * 如果没有,则返回默认值 **/ private function getString(params:Object, name:String, def:String):String{ if(params[name] != null){ return params[name]; } return def; } private function getNumber(params:Object, name:String, def:Number):Number{ if(params[name] != null){ return params[name]; } return def; } private function getBoolean(params:Object, name:String, def:Boolean):Boolean{ if(params[name] != null){ return params[name] == "true"; } return def; } ]]> </mx:Script> <fp:FlexPaperViewer id="FlexPaper" width="100%" height="100%" onDocumentLoaded="documentLoadedHandler(event)" onDocumentLoading="papersLoadingHandler(event)" onDocumentLoadedError="documentLoadedErrorHandler(event)" onLoadingProgress="onDocumentLoadingProgressHandler(event)" onCurrPageChanged="onCurrPageChanged(event)" onExternalLinkClicked="onExternalLinkClickedHandler(event)" onDocumentPrinted="documentPrintedHandler(event)" onPageLoaded="pageLoadedEventHandler(event)" onPageLoading="pageLoadingEventHandler(event)" onErrorLoadingPage="errorLoadingPageEventHandler(event)" Scale="{_Scale}" SwfFile="{_SwfFile}" ZoomTransition="{_ZoomTransition}" ZoomTime="{_ZoomTime}" MinZoomSize="{_MinZoomSize}" MaxZoomSize="{_MaxZoomSize}" ZoomInterval="{_ZoomInterval}" FitPageOnLoad="{_FitPageOnLoad}" FitWidthOnLoad="{_FitWidthOnLoad}" EncodeURI="{_EncodeURI}" FullScreenAsMaxWindow="{_FullScreenAsMaxWindow}" ProgressiveLoading="{_ProgressiveLoading}" SearchMatchAll="{_SearchMatchAll}" PrintPaperAsBitmap="{_PrintPaperAsBitmap}" ViewModeToolsVisible="{_ViewModeToolsVisible}" ZoomToolsVisible="{_ZoomToolsVisible}" NavToolsVisible="{_NavToolsVisible}" CursorToolsVisible="{_CursorToolsVisible}" SearchToolsVisible="{_SearchToolsVisible}" locale="{_localeChain}" PrintEnabled="{_PrintEnabled}" /> </mx:Application>
2、去打印按钮
我们找到FlexPaperViewer.mxml文件中的下面部分内容:
<mx:HBox styleName="toolbarBackground" width="100%" height="26" borderStyle="solid" verticalScrollPolicy="off" horizontalScrollPolicy="off" paddingTop="2" paddingLeft="2" horizontalGap="3"> <st:GradientImageButton icon="{MenuIcons.PRINT_ICON}" styleName="toolbttn" width="20" click="printPaper(event)" toolTip="@Resource(key='Print', bundle='FlexPaper')" visible="{!ReadOnly}" includeInLayout="{!ReadOnly}" /> <mx:Image source="{MenuIcons.BAR}" width="3" height="21" visible="{!ReadOnly}" includeInLayout="{!ReadOnly}" />
把上面代码的st:GradientImageButton部分代码注释掉就可以了
<!-- <st:GradientImageButton icon="{MenuIcons.PRINT_ICON}" styleName="toolbttn" width="20" click="printPaper(event)" toolTip="@Resource(key='Print', bundle='FlexPaper')" visible="{!ReadOnly}" includeInLayout="{!ReadOnly}" /> <mx:Image source="{MenuIcons.BAR}" width="3" height="21" visible="{!ReadOnly}" includeInLayout="{!ReadOnly}" /> -->
3、去右键注释FlexPaperViewer_Base.mxml
contextMenu.customItems.push(cmi_about); contextMenu.customItems.push(cmi_print);
4、去掉FP 关于我们按钮
找FlexPaperViewer.mxml文件会找到下面三行代码
//bttnInfo.visible = false; //bttnInfo.visible = (new MenuIcons.SMALL_TRANSPARENT().width > 10); //bttnInfo.visible = (new MenuIcons.SMALL_TRANSPARENT().width > 10);
5、右下角logo,FlexPaperViewer.mxml文件
除去加载页的 LOGO 图标,
将<fp:FlexPaperViewer_Base ...>的属性最后行加入 creationComplete 处理:
<fp:FlexPaperViewer_Base xmlns:mx="http://www.adobe.com/2006/mxml" addedToStage="bindStageEvents(event)" xmlns:fp="com.devaldi.controls.flexpaper.*" xmlns:ct="com.devaldi.controls.*" xmlns:st="com.devaldi.skinning.*" creationComplete="initApp()"> 然后加入处理 initApp()函数到<mx:Script>中 //---------------------------二次编程加入 public function initApp():void { paper1.removeElementAt(2); }
最 后 将 源 码 中 的 函 数
papersLoadingHandler(event:Event) 最 后 一 行 加
上:paper1.removeElementAt(2);
protected override function onViewModeChanged(event:ViewModeChangedEvent):void{ txtPage.text = formatPageNumber(viewer.currPage); super.onViewModeChanged(event); paper1.removeElementAt(2); }
6、视图切换logo
源文件:DupImage.as
找到语句:private var _skinImgl:Bitmap = new MenuIcons.LOGO_SMALL();
替换为: private var _skinImgl:Bitmap = new Bitmap();
相关推荐
Flexpaper二次开发入门教程
### Flexpaper二次开发入门教程概览 Flexpaper是一款由新西兰Devaldi公司开发的开源组件,主要用于在线浏览和展示各种类型的文档,如DOC、PPT、PDF等,无需额外的软件环境支持。Flexpaper遵循GPL开源协议,允许用户...
1.去除右上角fp字样 2.去除右下角logo 3.去除工具栏打印按钮 4.去除工具栏文字选择按钮(等价于文档内容不可复制) 5.去除右键菜单的打印、全选、复制等选项 6.增加鼠标悬浮按钮显示中文提示
在本文中,我们将深入探讨FlexPaper的这些关键特性以及如何进行二次开发。 1. **去除Logo**:在默认情况下,FlexPaper在显示文档时可能会在页面底部显示其Logo,这对于商业用途可能不是理想的。通过二次开发,...
### FlexPaper 二次开发教程知识点详解 #### 一、FlexPaper 概述 **1.1 FlexPaper 是什么?** FlexPaper 是一款由新西兰 Devaldi 公司开发的在线文档浏览组件,允许用户无需安装任何插件即可在网页上浏览多种格式...
### Flexpaper二次开发知识点 #### 一、Flexpaper概述 **1.1 Flexpaper定义** Flexpaper是一款由新西兰Devaldi公司开发的用于在线浏览多种文档格式(如DOC、PPT、PDF)的组件。该组件遵循GPL开源协议,允许用户...
这可能是为初学者提供一个了解为什么需要学习Flexpaper二次开发的起点。 **Flexpaper 介绍** 1. **Flexpaper是什么?** Flexpaper是一个开源的富媒体文档查看器,旨在提供一种优雅、用户友好的方式来展示文档,...
使用FlexPaper可以在WEB页面在线阅读PDF文件而不用安装Adodb reader客户端,附件包含FlexPaper二次开发教程、参考资料、最新版源码(2.2.4)、SWC库文件以及去除打印功能和屏蔽右键后的生成文件。
FlexPaper二次开发,重点实现记忆播放的功能,下次打开时可以直接跳转到上次观看的页面,同时还实现了去"水印"、去"About关于"、去“右键——>复制、打印等功能"。 二次开发实际是重新编译生成了FlexPaperViewer.swf...
去除logo,打印,增加js调用函数。修改加载中文名swf问题。
这个压缩包文件提供了一个FlexPaper的Demo,用于展示如何进行二次开发,特别是如何去除打印、关于界面、Logo以及将PDF转换为SWF格式的功能。 首先,让我们深入了解一下FlexPaper的基本功能。FlexPaper 提供了...
基于FlexPaper 2.1.2 版本修改的Flex源码 博客地址:http://www.cnblogs.com/xcong/p/3142155.html 修复双页、缩略图、搜索BUG。 去关于、Logo。 打印添加属性控制。 增加书签功能。
在进行FlexPaper的二次开发时,首先需要对Flex编程有一定的了解。Flex是基于ActionScript 3.0的开源框架,用于构建富互联网应用程序(RIAs)。开发者可以使用MXML和ActionScript来设计和构建用户界面,这使得...
### FlexPaper阅读器开发详解 #### 一、FlexPaper阅读器简介 FlexPaper阅读器是由Devaldi开发的一款免费的Flex程序库,主要用于在浏览器上展示服务器上的SWF文件,其展示方式类似于PDF阅读器。这使得用户可以方便...