FlashTextFormatter with SWFObject (Release 2)

Last month, I released a patch for the FlashTextFormatter WordPress plugin to use Geoff Stern’s SWFObject script. If you’re unaware, the plugin is designed to color code with a Flash component. It’s pretty cool.

[ftf w=480 h=60]var greeting:String = “Hello, Galaxy!”;[/ftf]

Today, I enhanced it to display the code in plain-text if JavaScript is disabled. I should have done this in the first place, but I wasn’t very familar with WordPress PHP code. After some tinkering around, I got things all fixed up. Grab the plugin and try it out! You can view the source of this page to see the output. It’s pretty standard SWFObject-based code though.

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. Geoff

    That’s very nice – what does the code look like on the admin side of things? Is it added automatically?

    Also, my code blocks are code tags with pre tags inside (sometimes), would I be able to customize the output of the text version?

  2. Josh Tynjala

    In WordPress, you can type your code like this:

    [ftf w=450 h=150]var x:Number = 0;
    
    function doSomething():Void
    {
        callSomethingElse();
    }[/ftf]

    The plugin will remove any html tags (WordPress likes to add extra line breaks and things), and it places the code within pre tags. I should probably use code tags as well, since it’s for code. I believe the only customization options are for the width and height. Maybe the language definitions include more options. I’m not the original developer. I merely patched the plugin to display SWFs via SWFObject so that IE users didn’t have to click twice.

  3. Joeflash

    Great mod, but my concern with this plugin is it makes printing code from the page impossible. How would you implement an alternate stylesheet combined with the SWFObject that allows the text and not the SWF to show up when the user prints the page?

  4. Pingback: aron / philipp development blog / FlashTextFormatter plugin for wordpress