Using Print2Flash Document API for Flash documents from Web Browser and other Applications
You may access Print2Flash Document API from any application that hosts a Flash document. The specific instructions on using Print2Flash Document API depend on how the host application is implemented. The access to Print2Flash document API is implemented using External API for Flash Player. See this page at Adobe website to get information on External API and its usage: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/2/help.html?content=00001036.html
Note: Using Print2Flash document API from other applications requires Flash Player 8 or higher.
Using Print2Flash Document API from a Web Page
First, publish a Flash document in a web page (see How to Publish a Document on the Web?).
Next, include the following code somewhere in the page header (within the HEAD tag):
After that you may call Print2Flash Document API functions using the following syntax:
Here <movieName> is the ID of the Flash movie embedding HTML tag (if you use HTML code generated by Save HTML command; it is equal to "Print2FlashDoc"), <funcname> and <parameters> are the function name and parameters as specified in Function Summary and <retvalue> is the variable name that receives the function return value (if any). For example, to set initial document settings after the page is loaded, e.g. to zoom document to 100 percent, go to the 5th page and activate Select Text mode for the document named Print2FlashDoc you may use the following code for the opening BODY tag:
The example above writes a new page number to the browser status window each time a current page number changes. (Note that writing to browser status window may be prohibited by your browser security settings).
The first parameter of the event handler function should be the sender parameter. It is the name of the Flash object that you used for the NAME attribute of the EMBED tag or the ID attribute of the OBJECT tag. This parameter may be helpful to differentiate between notifications generated by different documents if you have multiple documents in your movie and use a single event handler object. If you use the web page HTML code generated by Save Flash document with HTML preview page command of Print2Flash, this name is specified in the name variable in code:
The event handler may have additional parameters specific to each event. For example, onPageChanged event handler has a page parameter which specifies a new page number. These parameters are described in Print2Flash Document API events help topic.
See Customizing Print2Flash Document Interface sample for a more sophisticated example.
- Print2Flash document API support for browsers depends on the Flash Player capabilities and is provided in the following combinations of browser and operating system:
- Due to Flash Player security settings Print2Flash document API may not work in browser when the HTML page is opened from local disk. You may need to upload HTML page and Print2Flash document file to a web server to use it
|Internet Explorer 5.0 and higher||Windows|
|Netscape 8.0 and higher||Windows||Macintosh|
|Mozilla 1.7.5 and higher||Windows||Macintosh|
|Firefox 1.0 and higher||Windows||Macintosh|
|Safari 1.3 and higher||Macintosh|
|Opera 9.01 and higher||
Resizing Print2Flash Document Published in a Web Page
The Print2Flash Document API has a function named setSize which can be used to change Print2Flash document dimensions programmatically. However, this function is available for usage only from Flash or Flex. To resize Print2Flash documents embedded in a web page you may use width and height properties of the Print2Flash document object in this way: