Customizing Flash Paper 2 with Actionscript 2.0 (AS2)

I set out to customize Flash Paper using ActionScript 2.

There is a lot of info on the web, the best pages being:

But they don''t include very many examples of how to use the API, perhaps technically it is hacking. Here are a few things I figured out how to do. First things first you need to properly load the Flash Paper into your parent swf:

function loadFlashPaper(path_s, dest_mc) {
var intervalID = 0;
var loadFunc = function () {
dest_mc._visible = false;
var fp = dest_mc.getIFlashPaper();
if (!fp) {
//is not a flash paper and does not contain a valid flash paper API
dest_mc._visible = true;
intervalID = setInterval(loadFunc, 100);

Once it's loaded you can do a variety of things. Use a listener to use my own font for the zoom percentage text:

var fp = holder_mc.getIFlashPaper();
var zoomNotifier:Object = new Object();
zoomNotifier.onZoomChanged = function(percent:Number):Void {
percent = Math.round(percent);
zoom_mc.zoom_txt.text = percent+"%";

zoom_mc is my own custom movie that is controlled by the Flash Paper API listener, you can use the available listeners to customize most any part of the UI.

Remove that flash paper logo that links to adobes web site:

holder_mc.toolbar_mc.brandClip_mc._visible = false;

Remove the tool bar completely so that you can replace it with your own graphic if you like:

holder_mc.toolbar_mc._visible = false;

or disable different parts of the tool bar:

fp.showUIElement("Tool", false);
fp.showUIElement("Find", false);
fp.showUIElement("Pop", false);
fp.showUIElement("Overflow", false);

If you are having focus issues when using multiple flash papers in the same window you can use code like this in each flash paper container and just trigger focused to true or false when one is clicked or rolled over. The lastScrollValue var is to keep the enableScrolling from being called every loop. You could use an interval here but I like using movies because they unload themselves once they are moved off stage.

this.createEmptyMovieClip("looper_mc", this.getNextHighestDepth());
focused_bl = true;
lastScrollValue_bl = true;
looper_mc.onEnterFrame = function() {
if (!focused_bl && lastScrollValue_bl) {
lastScrollValue_bl = false;
} else if (focused_bl && !lastScrollValue_bl) {
lastScrollValue_bl = true;

Controlling the scroll bars and the viewable area inside the Flash Paper. If have a document that you want to make zoom in on a certain area using ActionScript 2 you need to use the getVisibleArea() object.

Here is an example:

visArea_obj = new Object();
visArea_obj = fp.getVisibleArea();
visArea_obj.x = 97.37;
visArea_obj.y = 82.677;
visArea_obj.w = 620.47;
visArea_obj.h = 285.03;
visArea_obj.s = 0;

Now you might ask what is this commented out fnExtractObjVars?

In the white papers for the Flash Paper 2 API, they don''t really cover the in's and out's of the returned object so did an object dump to determine what is inside so that I could manipulate the variable. My advice is to load the flash paper with its working tool bar and everything and zoom to the location you want and position the page how you want by hand then have fnExtractObjVars tied to a button and trace out all the values you need then go back and put them into ActionScript 2. The function fnExtractObjVars goes like the following:

function fnExtractObjVars(theObj:Object) {
for (var i in theObj) {
fnErrorMessage(i+" : "+theObj[i]);

Finally something I found that I couldn't do. You might want to know about using ActionScript 2 to load things into the actual tool bar. This is somewhat of a mystery for me because I spent many hours trying to go in and load movies in dynamically.

I used code like this:












But it did not work. I think it is protected in its own security sandbox. So if you are attempting such things and finding your objects not being created inside of the Flash Paper document hierarchy then you are not alone. If you have found a way to do this then please do share with us. But when I would run debug they never showed up. They loaded fine anywhere outside of the Flash Paper but it was as if Macromedia (the people who originally created Flash Paper before Adobe bought it and discontinued it because it was a threat to their PDF technology) had locked everything to make it tamper proof.

comments powered by Disqus