1. First download the flexpaper source code.
2. I am not familiar with flash, but Baidu, and then I am blind. My flash build 4.5
Key: 1499-4181-9296-6452-2998-3656-
First, create a new Flex project in Flash build. The first step is to enter the project name-flexpaper, and the second step is the default one. The last step should be noted.
Select merge to code. Otherwise, many other SWF files will appear in your bin-DEBUG directory.
Decompress the source code downloaded in step 1.
Copy all the three directories to the root directory of the Flex project you just created. The final result is as follows:
Click the properties of the project and modify the additional compilation parameters as follows.-source-Path = locale/{locale}
Display Chinese characters in the menu bar:
Right-click the project ---> properties ----> flex compiler ---> Add the following sentence to the additional compiler parameter box: -locale zh_cn-source-Path = locale/{locale}-keep-all-type-selectors = true.
After all these operations are completed, it seems that there is an error in one file. If there is a red × in front of the error file, right-click the project attribute, select the flex compiler, and select "use Flex 3 compatibility mode"
Modify:
1. There is a FP in the upper right corner. After clicking it, the "about" button appears.
Find the following file:
Open and search for bttninfo. There are three sentences in total, all commented out. Then in run, you will find that the FP in the upper right corner is gone. (Print is also modified in this file. Let's take a look)
2. Modify the logo in the lower right corner, as shown below:
Find the following file, open it, and find the createdisplaycontainer function. Add _ skinimgdo. Visible = false to addchild (_ skinimgdo); (although you don't understand it, you can also know about it)
Okay. Modification completed. For other modifications, you can check the source files by yourself. All functional foreigners help us with reality. We only need to repair, modify, and fix the problem.
In addition, if you want to use it, enter:
Find flexpaper.swf under bin-debug. (Other SWF files are those that I have not previously merged into the Code. If they are not merged, copy all these SWF files together)
In the example you downloaded it, replace it with the following:
Change the file name to OK. Then, you can find it in the running process.
The above method seems to have killed flash. The SwF compiled by this method below should be able to dynamically load flash. (Found online)
<? 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: SCRIPT>
<! [CDATA [
Import MX. Controls. Alert;
Public VaR _ Aid = 0; // Document ID
[Bindable]
Public VaR _ scale: Number = 1; // scaling ratio
[Bindable]
Public VaR _ swffile: String = ""; // SWF file path
[Bindable]
Public VaR _ zoomtransition: String = "easeout ";
[Bindable]
Public VaR _ zoomtime: Number = 0.6;
[Bindable]
Public VaR _ zoominterval: Number = 0.1;
[Bindable]
Public VaR _ fitpageonload: Boolean = false; // height after loading
[Bindable]
Public VaR _ fitwidthonload: Boolean = false; // suitable for width after loading
[Bindable]
Public VaR _ printenabled: Boolean = true; // whether printing is supported
[Bindable]
Public VaR _ fullscreenasmaxwindow: Boolean = false; // whether to pay full screen
[Bindable]
Public VaR _ progressiveloading: Boolean = false; // whether to delay Loading
[Bindable]
Public VaR _ localechain: String = "zh_cn"; // Language
Private var isfocus: Boolean = false;
// Initialization parameters
Private function initapp (): void {
VaR Params: Object = application. application. parameters;
_ Scale = getnumber (Params, "scale", 1 );
_ Swffile = getstring (Params, "swffile", "paper.swf ");
_ Zoomtransition = getstring (Params, "zoomtransition", "easeout ");
_ Zoomtime = getnumber (Params, "zoomtime", 0.6 );
_ Zoominterval = fig (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"];
// Register event listening
This. addeventlistener (mouseevent. mouse_over, onmouseover );
This. addeventlistener (mouseevent. mouse_out, onmouseout );
// Open to external (JavaScript) calls
Externalinterface. addcallback ("hasfocus", hasfocus );
// Externalinterface. addcallback ("Focus", focus );
Externalinterface. addcallback ("setviewerfocus", setviewerfocus );
}
Private function onmouseover (Event: mouseevent): void {
This. isfocus = true;
}
Private function onmouseout (Event: mouseevent): void {
This. isfocus = false;
}
Public Function hasfocus (): Boolean {
// Alert. Show ("hasfocus ");
Return isfocus;
}
Public Function setviewerfocus (isfocus: Boolean): void {
// Alert. Show ("setviewerfocus ");
This. paperviewer. setviewerfocus ();
}
/**
*
* Obtain string-type parameters
* If not, the default value is returned.
**/
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 {
// Alert. Show ("comparison:" + name );
If (Params [name]! = NULL ){
Return Params [name] = "true ";
}
Return def;
}
]>
</MX: SCRIPT>
<! -- Mx: panel X = "165" Y = "76" width = "250" Height = "200" layout = "absolute" Title = "One Person">
<Mx: Label x = "59" Y = "37" text = "{scale}" width = "88"/>
</MX: panel -->
<FP: flexpaperviewer id = "paperviewer"
Width = "100%"
Height = "100%"
Scale = "{_ scale }"
Swffile = "{_ swffile }"
Zoomtransition = "{_ zoomtransition }"
Zoomtime = "{_ zoomtime }"
Zoominterval = "{_ zoominterval }"
Fitpageonload = "{_ fitpageonload }"
Fitwidthonload = "{_ fitwidthonload }"
Printenabled = "{_ printenabled }"
Fullscreenasmaxwindow = "{_ fullscreenasmaxwindow }"
Progressiveloading = "{_ progressiveloading}"/>
</MX: Application>
However, after trying the above method, you cannot call the API provided by the official website. The reason is that the above program does not provide an interface (the interface is in flexpaperviewer_base.mxml ).
You only need to add the following statement to call the gotopage interface.
public function gotoPage(p:Number):void{
paperViewer.gotoPage(p);
}
Don't forget to add a listener to call JS
ExternalInterface.addCallback("gotoPage", gotoPage);
This is OK. The compiled API can be loaded.
Add print:
Add a listener to call JS
ExternalInterface.addCallback("printPaper", printPaper);
Public Function printpaper (): void {
Paperviewer. printpaper ();
}
Modify flexpaperviewer. mxml
Click = "printpaper (event)" is click = "printpaper ()"
Modify flexpaperviewer_base.mxml
Public Function printpaper (E: Event): void {...} is public function printpaper (): void {...}