FlashTextFormatter patched with SWFObject

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 Josh Tynjala

Josh Tynjala is a frontend developer, open source contributor, bowler hat enthusiast, and karaoke addict. You might be familiar with his project, Feathers UI, an open source user interface library for Starling Framework that is included in the Adobe Gaming SDK.

Discussion

  1. Rostislav Siryk

    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 (“