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:

<cfdocument format="flashpaper" name="fp">
<h1>Flash Paper Help</h1>

<p>
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.
</p>
</cfdocument>

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

<cfform name="test" format="flash" width="650" height="600">

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

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