Flash Forms and Flash Paper

This morning I posted about using PDFs in Flash Forms. The short answer was that it was not possible. On the entry, Simeon mentioned he was working on a way to get Flash Paper into Flash Forms. That was enough to distract me and see if I could build it as well. What’s nice is that you can use the same technique I talked about during my series on embedding charts in Flash Forms. Consider the following code sample:

<FONT COLOR=MAROON><cfdocument format=<FONT COLOR=BLUE>"flashpaper"</FONT> name=<FONT COLOR=BLUE>"fp"</FONT>></FONT>
<FONT COLOR=NAVY><h1></FONT>Flash Paper Help<FONT COLOR=NAVY></h1></FONT>

<FONT COLOR=NAVY><p></FONT>
The following text would normally describe how a person would fill out the form.
It could discuss what the fields mean. Of course, most people don't need help
filling out forms, and if they do, they probably shouldn't be in front of a computer
anyway.
<FONT COLOR=NAVY></p></FONT>
<FONT COLOR=MAROON></cfdocument></FONT>

<FONT COLOR=MAROON><cfset fileName = expandPath(<FONT COLOR=BLUE>"./flashpaper.swf"</FONT>)></FONT>
<FONT COLOR=MAROON><cffile action=<FONT COLOR=BLUE>"write"</FONT> file=<FONT COLOR=BLUE>"#filename#"</FONT> output=<FONT COLOR=BLUE>"#fp#"</FONT>></FONT>

<FONT COLOR=MAROON><cfform name=<FONT COLOR=BLUE>"test"</FONT> format=<FONT COLOR=BLUE>"flash"</FONT> width=<FONT COLOR=BLUE>"650"</FONT> height=<FONT COLOR=BLUE>"600"</FONT>></FONT>

   <FONT COLOR=MAROON><cfformgroup type=<FONT COLOR=BLUE>"tabnavigator"</FONT>></FONT>
   
      <FONT COLOR=MAROON><cfformgroup type=<FONT COLOR=BLUE>"page"</FONT> label=<FONT COLOR=BLUE>"Registration Form"</FONT>></FONT>
      
         <FONT COLOR=MAROON><cfinput type=<FONT COLOR=BLUE>"text"</FONT> name=<FONT COLOR=BLUE>"name"</FONT> label=<FONT COLOR=BLUE>"Name"</FONT> required=<FONT COLOR=BLUE>"true"</FONT>></FONT>
         <FONT COLOR=MAROON><cfinput type=<FONT COLOR=BLUE>"text"</FONT> name=<FONT COLOR=BLUE>"email"</FONT> label=<FONT COLOR=BLUE>"Email"</FONT> required=<FONT COLOR=BLUE>"true"</FONT>></FONT>
         <FONT COLOR=MAROON><cfinput type=<FONT COLOR=BLUE>"text"</FONT> name=<FONT COLOR=BLUE>"age"</FONT> label=<FONT COLOR=BLUE>"Age"</FONT> required=<FONT COLOR=BLUE>"true"</FONT>></FONT>
         <FONT COLOR=MAROON><cfinput type=<FONT COLOR=BLUE>"text"</FONT> name=<FONT COLOR=BLUE>"something"</FONT> label=<FONT COLOR=BLUE>"Something"</FONT> required=<FONT COLOR=BLUE>"true"</FONT>></FONT>
      
      <FONT COLOR=MAROON></cfformgroup></FONT>
   
      <FONT COLOR=MAROON><cfformgroup type=<FONT COLOR=BLUE>"page"</FONT> label=<FONT COLOR=BLUE>"Help"</FONT>></FONT>
         <FONT COLOR=MAROON><cfformitem type=<FONT COLOR=BLUE>"html"</FONT> height=<FONT COLOR=BLUE>"500"</FONT> width=<FONT COLOR=BLUE>"600"</FONT>></FONT><FONT COLOR=NAVY><FONT COLOR=PURPLE><img src=<FONT COLOR=BLUE>"flashpaper.swf"</FONT> width=<FONT COLOR=BLUE>"500"</FONT> height=<FONT COLOR=BLUE>"600"</FONT>></FONT></FONT><FONT COLOR=MAROON></cfformitem></FONT>
      <FONT COLOR=MAROON></cfformgroup></FONT>
      
   <FONT COLOR=MAROON></cfformgroup></FONT>
   
<FONT COLOR=MAROON></cfform></FONT>

We start off by generating the FlashPaper SWF and storing it into a variable. This data then gets written to a file. Normally you would not want to do this for every request. Once we have the FlashPaper stored, we can then reference it simply by using an IMG tag. In my example, I put the Help documentation in a different tag. The main problem had with this example was spacing. The IMG tag’s width and height attributes didn’t seem to be respected by the SWF. I’m sure a reader out there will figure out why…

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments