FlashPaper is very useful, we can create web-ready Flash documents or secure, compact PDF files from any printable document in just one click with FlashPaper.  The following is some main feature of FlashPaper introduced on the offical site:

  • Easily create or e-mail any Microsoft Office document as a Flash document or PDF
  • Instantly secure sensitive medical, legal or business documents
  • Streamline document distribution with highly compressed files
  • Create universally accessible files that are viewable on any platform
  • Quickly capture web pages and HTML
  • Create online newsletters, flyers and marketing materials

Adobe-FlashPaper_1808g

But if you are a flex developer, who has ever tried to load a FlashPaper document within a Flex application, then you should know it’s not so simple. The problem is: when a FlashPaper SWF is loaded in the flash player directly, as window is resized the area available for the document resizes, but the toolbars at the top stay the same height. Here is a sample on how to load FlashPaper in Flex, you can download full source code from downloadhere.

Flex souce code:

  1. < ?xml version="1.0" encoding="utf-8"?>
  2. <mx :WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initType()">
  3.     </mx><mx :Script>
  4.         < ![CDATA[
  5.             import com.magReader.FlashPaperLoader;
  6.             //flashpaper
  7.             private var magReader:FlashPaperLoader;
  8.  
  9.             private function initType():void
  10.             {
  11.                 var urlStr:String = "Fpl.swf?url=template.swf";
  12.                 magReader = new FlashPaperLoader();
  13.                 magReader.source = urlStr;
  14.                 magReader.visible = false;
  15.                 magContainer.addChild(magReader);
  16.                 //loadingBar.visible = true;
  17.                 magReader.addEventListener(FlashPaperLoader.FLASH_PAPER_LOADED,fpLoaded);
  18.             }
  19.             //flashpaper
  20.             private function fpLoaded(evt:Event):void
  21.             {
  22.                 //trace("magContainer width = " + magContainer.width + " magContainer height = " + magContainer.height);
  23.                 magReader.setSize(magContainer.width,magContainer.height);
  24.                 magReader.visible = true;
  25.                 //loadingBar.visible = false;
  26.  
  27.                 //magContainer.removeChild(loadingBar);
  28.                 magReader.removeEventListener(FlashPaperLoader.FLASH_PAPER_LOADED,fpLoaded);
  29.             }
  30.  
  31.             public function changSize():void
  32.             {
  33.                 if(magReader != null)
  34.                 {
  35.                     magReader.setSize(magContainer.width,magContainer.height);
  36.                 }
  37.             }
  38.         ]]>
  39.     </mx>
  40.  
  41.     <mx :Canvas id="magContainer" width="100%" height="100%" resize="changSize()" horizontalScrollPolicy="off" verticalScrollPolicy="off">
  42.  
  43.     </mx>

For help, advice, tips and tricks, challenges, feel free to visit ourDoNotYet forum or Submit your good resource to share.

Reminder: Unless stated otherwise, all resources published on this site are NOT for commercial use. To use any resource from this site for commercial purposes, please contact the author.

Related Posts