SwfObj Version 0.9.2

Big changes are finally here in SwfObj land. Thanks to the encouragement of fantastic SwfObj users, such as yourself, I've mustered up the motivation to implement what I consider to be a major feature. Dynamic Embedding of Flash objects is finally available with SwfObj.

Dynamic vs. Static Embedding

Prior to this release, the only option for embedding Flash objects with SwfObj, was statically. This embeds the objects directly into the html rendered by WordPress.

By dynamically embedding them, WordPress instead places a div tag on the page that holds the alternative content only. Once the page has loaded, Javascript replaces this alternative content with the Flash object.

I'll defer you to the official SwfObject project for the advantages and disadvantages of either SwfObject embedding method.

How to embed objects dynamically

By default, SwfObj is set to embed statically. If you would rather use dynamic embedding by default on your site, it is very easy to change the settings. Go to Settings > SwfObj and in "Default Embedding Mode" select "Dynamic Publishing". Save your changes and you're all set.

If you ever want to use the other method for a particular post, you can override the default with the new dynamic_embed attribute. Here are a couple examples.

[swfobj src="..." dynamic_embed="true"] ← (embedded dynamically)
[swfobj src="..." dynamic_embed="false"] ← (embedded statically)

Other developments

In more exciting news, Joen Asmussen the developer behind the Flash Shorttags SwfObject Plugin requested that I merge in features from his plugin so he could discontinue it in favor of SwfObj. As a result, you can also use the [flash] shorttag to embed your Flash objects. I really appreciate Joen approaching me about merging our two plugins. It makes things simpler for everyone out there looking for an easier way to embed Flash on their WordPress site.

I originally developed this plugin for myself because embedding Flash was such a pain. It's been great to see so many other people getting value from it as well. Thanks to your help and suggestions SwfObj continues to improve. Please continue to send any comments or suggestions you may have as you use it on your sites. And if you really want to show your appreciation, feel free to buy me lunch.

This entry was posted in Flash, Flex, SwfObj, WordPress and tagged , , , , , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://noscope.com Joen

    Your hard work in this is very much appreciated, and it was no hard decision to retire my plugin in favor of yours. As you know I’ve tested your work already, and it is far superior to my endeavour. It’s a pleasure to finally have an appropriately stable and useful Flash embed plugin on the WordPress platform (after all these years!).

  • Pingback: Flash Shorttags for Wordpress Plugin [Update: Retired] (Noscope)()

  • carst van der molen

    Thank you very much!! I have been waiting for this.
    Makes the plugin much more useful.

  • http://dayoneweddingcinema.com Brian

    This is a great plug-in. I’m new at this and hope you can answer a question.

    Could you point me to a page or suggest a method for substituting a jpg image when the user doesn’t have flash installed?

    Any help is greatly appreciated!

    • http://orangeSPLoTCH.com mattc

      All you have to do is set the ‘alt’ attribute in the shortcode. The content of the ‘alt’ attribute is displayed when the user does not have Flash installed. Here’s an example:
      [swfobj src=”…” alt=”<img src=’noflash.jpg’ />”]
      Notice that I’m using single quotes inside of double quotes.

      You can also set the default alt content by going to Settings > SwfObj. Enter whatever you want in the “Alternative Content” field and save. This content will be used as the ‘alt’ content for all of your swfobj tags that don’t explicitly define it.

  • http://www.monogo.net Joachim

    hi there,

    I want to add a Flash movie to my header.php, running with WP 2.9

    This: [flash src="http://www.mydomain/firstload.swf" width="880" height="220"]
    Does not work.
    Any idea what went wrong?


    • http://orangeSPLoTCH.com mattc

      The SwfObj plugin only works for Post/Page content. Unfortunately, it is not supported in template files, like header.php. It’s a feature I’m hoping to add in a future release.

  • http://www.web527.server-drome.net/videowiki/ Anja

    Dear Matt,
    I love your plugin!
    Just one thing….
    I have made some instruction videos with jing (swf format) and these videos usually are fullscreen.
    When I insert them (have the size set to 450 / 350) the player is resized but the Video is cut so you just see part of it.
    Is there a way to make that work?
    Example here:

    Thanks so much!

  • http://orangeSPLoTCH.com mattc

    Unfortunately, resizing the embedded object just does what you are seeing, changes the size of the window, but not the content inside it. The player should be able to resize the video for you, but different players have different setups. Look into the documentation for the player you are using to see how you can scale the video down to fit in the window.

    Sorry I can’t be more help with this.

  • http://www.rke.as Kai


    I’ve just startet using wordpress, and installed your plugin a few days ago.
    Everything is going smooth adding a flash file in a normal post.
    But I have trouble trying to change the header on the webpage, from jpg to swf.

    As fare as I can see, the code that adds the header.jpg is in the stylesheet style.css file, code:

    #home{background:transparent url(images/header.jpg) no-repeat;width:990px;height:250px; margin:0 auto;list-style:none;}

    Are you able to help me on what to write, when I want to include an swf file instead of the jpg. The files are located at the same place. My swf file is called rkeas_flashtest.swf

    BR Kai

  • http://orangeSPLoTCH.com mattc

    Assuming your swf is the same dimension as the header. I would change the header.php as follows to embed the swf. You can then remove that #home line from the style.css file.

        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="headerswf" width="900" height="250">
          <param name="movie" value="<?php bloginfo('template_directory'); ?>/rkeas_flashtest.swf" />
          <!--[if !IE]>
          <object type="application/x-shockwave-flash" data="<?php bloginfo('template_directory'); ?>/rkeas_flashtest.swf" width="900" height="250">
            <img src="<?php bloginfo('template_directory'); ?>/images/header.jpg" width="990" height="250" />
          <!--[if !IE]>
  • http://www.rke.as Kai

    Thanks for the code!

    I tried to delete the #home line, and insert your code into the header.php but it didn’t work.

    I know to litle php and html to experiment whit this. So I think I will leave it for now. Thanks for helping. :)


  • Serge

    Thanks for the impressive plugin!

    I’m playing with it a bit but can’t seem to figure out how to pass parameters to an inserted swf.

    Actually, I’m testing with the amazing Flexpaper (flash version), but all I manage to render is the viwer itsel, not the selected file (selected in FlexPaper, that is).

    Am I missing something ?

    Thanks anyway !


  • Helen

    Very good plug-in! Thanx
    I wonder if you or anyone can help me with this:
    In WP I can insert swf no problem also interactive works. But I also have swf that loads other movies or clips in to a mainmovie (loadMovie). That does not work in WP, it will not load anything. All swf are in the uploads-folder. If I do as an iFrame or plain HTML-page wout php it works fine WP as on any webpage.
    Is this a php-security-thingy (not so good att that)or how can I make this work in posts/pages without iFrame?

  • http://orangeSPLoTCH.com mattc

    I can’t say exactly what the problem may be, but usually the problem is because the swf is looking for the movies in the same directory as the page is in, which isn’t the uploads directory. If you can give it the full path to the movie clips instead of just their names, that should solve it. For example instead of example.swf use /wp-content/uploads/example.swf

    Feel free to contact me offline if you still have questions about this.