FlashTextFormatter patched with SWFObject

by Josh Tynjala

I’ve been using the FlashTextFormatter plugin for WordPress for some time now. It’s a great way to add color coding to Actionscript and other languages. Plus, the code box is a Flash component, so I feel like I’m eating my own dogfood. Thanks to the Internet Explorer Eolas change, some users need to click an extra time if they want to scroll the code. I had hoped to see a patch for this behavior, but I finally decided to write it myself. The plugin now uses Geoff Stearns’ SWFObject script to add the FTF component to my posts. Here’s an example:

[ftf h="120"]function demoFunction(param:String):Void
{
trace(“Hi there!”);
}[/ftf]

You can view the source of this page to see what the plugin generates if you’d like.
It’s pretty standard SWFObject code. Most importantly, I had to be sure that multiple FTF components could appear on a page. The markup includes identifiers for the post and for each instance of the FTF component in a particular post. I had hoped to include support for displaying the code even when Flash isn’t available, but I’m not sure how to extract that data.

If you’d like to use my patched version of the plugin, I’ve made it available for download.

About the Author

Josh Tynjala is an indie game developer, entrepreneur, Flash and Flex mercenary, and bowler hat enthusiast.

Discussion
  1. Great.

    “I had hoped to include support for displaying the code even when Flash isn’t available”

    Take a look at this URL.

    If you want to continue improving it please contact me if you need help.

    posted by Igor Dimitrijevic on 05.24.2006
  2. You wrote

    >> I had hoped to include support for displaying the code even when Flash isn’t available, but I’m not sure how to extract that data.

    Maybe it is possible to use XMLHTTPRequest to retrieve AS code from php script and write it inside your flash container div (“

    posted by Rostislav Siryk on 05.24.2006
  3. Sorry, triangular bracket broke down the end of my post. I mean “… inside your flash container div (“<div id=”ftf-71-0″ … )?

    posted by Rostislav Siryk on 05.24.2006
Share Your Thoughts

To display code in comments: <pre>Code here. May be multiline. Format XML with &gt; and &lt; entities.</pre>

Some HTML allowed in comments: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>