Customizing Flash Paper 2 with Actionscript 2.0 (AS2)

recently I set out to customize flash papers using actionscript. 
There is a lot of info on the web the best pages being: 
http://www.adobe.com/support/documentation/en/flashpaper/2/flashpaper_api/

But they don't include very many examples of how to use the API. 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
return;
}
dest_mc._visible = true;
clearInterval(intervalID);
};
intervalID = setInterval(loadFunc, 100);
dest_mc.loadMovie(path_s);
}


once its loaded you can do a variety of things.

Use a listner 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+"%";
};
fp.addListener(zoomNotifier);


zoom_mc is my own custom movie that is controlled by the flash paper API listner,
you can use the available listners 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 rebuild it in your own image:

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) {
fp.enableScrolling(false);
lastScrollValue_bl = false;
} else if (focused_bl && !lastScrollValue_bl) {
fp.enableScrolling(true);
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 you need to use the getVisibleArea() object.

here is an example:

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


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 ins and outs 
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. 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
action script 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:

holder_mc.toolbar_mc.createEmptyMovieClip(
"coverholder_mc",
holder_mc.toolbar_mc.getNextHighestDepth()
);
this.holder_mc.toolbar_mc.attachMovie(
"Fcover",
 "brandClip_mc",
this.holder_mc.toolbar_mc.brandClip_mc.getDepth()
);

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 than 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 had locked everything from being messed with.

Trackback(0)
Comments (11)add comment

Amar Singh said:

Hello Nicholas,

I have word document, and i want to convert it into flash paper document. it is working but i am facing two problem after it conversion.

1. margin is not same as word document
2. Bullet is changed
3. scroll bar is not scrolling smoothly

plz help me.

thanx in advance.
Amar Singh
 
report abuse
vote down
vote up
January 03, 2010
Votes: +0

Nicholas said:

These are problems with the exporter they cannot be fixed by hacking flash paper with as2. You have to adjust the doc to get the right look sometimes. Also sometimes word 2007 does not export correctly. Slow scrolling could have to do with the complexity of your content and the time that it takes to render. Have you tried scribed or acrobat. Flash paper is an old and now unsupported technology which is too bad because I thought it was very useful for loading in content into my Flash applications. Best of luck to you, -Nicholas
 
report abuse
vote down
vote up
January 05, 2010 | url
Votes: +0

Pimager said:

Hello, could you tell me what is "holder_mc"? thank you
 
report abuse
vote down
vote up
February 23, 2010
Votes: +0

Nicholas said:

holder_mc is the container into which the Flash Paper has been loaded.
 
report abuse
vote down
vote up
February 27, 2010 | url
Votes: +0

Pimager said:

Thank you Nicholas
 
report abuse
vote down
vote up
February 28, 2010
Votes: +0

Dmitriy said:

Nicholas, thx a lot for interesting and useful information! it's really helps me!
smilies/wink.gif
but i've one more question - can i change a language of tips to my native?
 
report abuse
vote down
vote up
July 06, 2010
Votes: +0

Nicholas said:

sorry man I have no idea without digging into it and I have moved on to being focused on other things, I suggest using the flash debugger and using the object browser to see if you can find the source of the data.
 
report abuse
vote down
vote up
July 12, 2010 | url
Votes: +0

Richard Rambarran said:

Hello Nicholas,

I am looking for a site/shop that sells Flash Paper for a project that currently uses Flash Paper and has no intention of changing. Do you know where I can buy Flash Paper?

Also, has there been a suitable replacement for Flash Paper?

Thank You Richard
 
report abuse
vote down
vote up
August 19, 2010 | url
Votes: +0

nicholas said:

Flash paper was developed by Macromedia as a competing product to Adobe Acrobat. When Adobe bought Macromedia they discontinued Flash Paper. Too bad flash paper was a slimmed down version of Acrobat and loaded way faster. Try Ebay or Bit Torrent.
 
report abuse
vote down
vote up
September 01, 2010 | url
Votes: +0

omar said:

Nicholas

Awesome article - really helped me

I wanted to something: can I create a Flash Paper document and then afterwards add animation/interactivity or even video to specific pages?

That would be awesome if I could do

Let me know what you think

Thanks


Omar
 
report abuse
vote down
vote up
December 14, 2010
Votes: +0

nicholas said:

Sorry flash paper does not support embedded content as far as I know. If you are going to do this kind of thing I suggest building your own template.
 
report abuse
vote down
vote up
December 15, 2010 | url
Votes: +0

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security image
Write the displayed characters


busy