Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

FlashPaper 2.0 ActionScript API

A FlashPaper 2.0 document exposes a single function at the root level:

function getIFlashPaper():FlashPaper.IFlashPaper; 

This returns an object that implements the IFlashPaper interface. If this function is not defined, then the SWF file is not a FlashPaper 2.0 document. If this function exists, but returns a value of null or undefined, then the SWF file is a FlashPaper 2.0 document, but has not yet loaded enough to access the API; you must wait for it to load more fully and call it again.

The IFlashPaper interface in ActionScript 2.0 looks like this:

interface FlashPaper.IFlashPaper
function addListener(listener:Object):Void;
function removeListener(listener:Object):Void;
function getViewerType():String;

function getViewerVersion():Number;
function getCurrentPage():Number;
function setCurrentPage(pageNumber:Number):Void;
function getNumberOfPages():Number;
function getLoadedPages():Number;
function showUIElement(part:String, flag:Boolean):Void;
function printTheDocument():Boolean;
function setCurrentZoom(percent:Object):Void;
function getCurrentZoom():Number;
function setSize(w:Number, h:Number):Boolean;
function goToLinkTarget(linktarget:String, window:Object):Void;
function enableScrolling(flag:Boolean):Boolean;
function getCurrentTool():String;
function setCurrentTool(tool:String):Boolean;
function getTextSelectionRange():FlashPaper.SelectionRange;
function setTextSelectionRange(sel:FlashPaper.SelectionRange,
function getSelectedText():String;
function getSidebarWidth():Number;
function setSidebarWidth(w:Number):Void;
function getFindText():String;
function setFindText(s:String):Void;
function findNext():Boolean;
function getVisibleArea():Object;
function setVisibleArea(area:Object, skipBroadcast:Boolean):Void;

That’s a lot of functions—let’s take a look at each one.