Tag Archives: swfobject

New updates available…

As promised I updated NextGEN Gallery and wordTube for the support of swfobject 2.1. This updates are required to embedded the flash object in a new way and keep compatible with other plugins like Viper’s Video Quicktags.

Please note that some other flash plugins or addons (Nextgen FlashViewer will be updated very soon) can be get in conflict, because the new script is not compatible with older versions. I suggest not to upgrade until the author update there plugins, because this release is not mandatory…

Wish you all a nice weekend ! 

Tagged , ,

Final test week

I have uploaded the release canidate for wordTube. It contains now the swfobject 2.1 for showing the flash content and is compatible to other plugins , like Viper’s Video Quicktags. Please update to this version and report your issues at my GoogleCode project.

Please note :This version breaks the currently swfobject of NextGEN Gallery (and as well the addon’s like the Flashviewer). If you are interested, you can test also the update for NextGEN Gallery, here you get the version.

If I faced no big problems, both updates will be available end of the next week at wordpress.org

Happy testing !

Tagged , ,

SWFObject 2.1

This article is for plugin authors which uses the great swfobject JavaScript library. The new version 2.1 contains a complete new way to emded and prepare the script code for the flash content. It’s NOT backward compatible with the implementation of version 1.5 , so it breaks my plugins wordTube and NextGEN Gallery. Due to the fact that I need to rework this for both plugins, I created a small PHP class which makes it much easier to implement the script code.

For example : 

$swf = new swfobject( $url, 'id', $width, $height, '7', 'false');

This initiate the swfobject with the url of the flash and the width/height settings and set an id name. This PHP class ensure that the id is not used two times, because it append always a internal counter. 

You can add to the $swf object new parameters, attributes or flashvars :

$swf->add_params('wmode', 'opaque');
$swf->add_flashvars( 'myboolval', $option_a, 'false', 'bool');
$swf->add_flashvars( 'myintval', $option_b);
$swf->add_flashvars( 'mystring, 'abcdef');

Now you can generate the output for your content with the follow function :

$out = $swf->output();

And the generated javascript code can be done with the function:

$js = '';
$js .= $swf->javascript();
$js .= '';

Please note that you can add the JavaScript code to any position in your output, but it’s recommended to add this to your header or footer area. To keep it more flexible it will not automatic add the <script>  wrapper around the code.

This functions produce now the follow HTML output :

<div class="swfobject" id="id_1" style="width:160px;height:120px;">
Get the Flash Player to see the flash content.

var id_1 = {
    params : {
       wmode : "opaque" },
    flashvars : {
        myboolval : "true",
        myintval : "10",
        mystring : "abcdef" },
    attr : {},
    start : function() {
        swfobject.embedSWF("file.swf", "id_1", "160", "120", "7", false, this.flashvars, this.params , this.attr );


This few lines of code should demonstrate how easy you can create dynamic swfobject content with PHP, without build up the JavaScript code manually. The swfobject script will automatic exchange the <div> element with the flash content.

You can download the class from my current GoogleCode trunk :

Download swfobject.php
PHP class @ Google Code

Tagged , , ,