swfObject module for drupal

updated: Please see the drupal project: http://drupal.org/project/swfobject_api for updates
updated: swfmodule to more recent version
I created a way to use the swfobject library in drupal. This allows a developer to make a call like:

print swfobject_create($url, $params);

To display a swf file. Url is the web accessible address to the file. Params are the flash parameters- not needed, but if they aren't set, height and width are set to 100%

Updated September 1, 2006

  • Changed the syntax of the call (now is swfobject_create)
  • It force loads the JS file by default, but checks to see if it's been loaded already
  • It uses hook_nodeapi to load the js in case a cached function called it originally (checks $node->body for the swfobject)
  • Has an install file which checks for the presence of the swfobject.js file
  • This tarball has the swfobject.js file included, however, since it is under the MIT license, it should really be downloaded separately to comply with the GPL
  • Download here: swfobject.tgz

    I get this error when trying

    I get this error when trying to install:

    Parse error: parse error, unexpected '{' in /var/www/html/drupal/modules/swfobject/swfobject.install on line 7

    any ideas?

    Woops. Try the new download.

    Woops. Try the new download. Should be all fixed up

    I have also created a drupal

    I have also created a drupal module for using swfobject. Mine will create any number of blocks that each contain a flash movie embedded using swfobject. Each block configuration has options for movie width, height, bgcolor, transparency, flashvars and many more. Check it out. http://drupal.org/project/swfobject

    Thanks for the heads up. I

    Thanks for the heads up. I just posted a note on your module about having an API for other modules to leverage. See it here: http://drupal.org/node/89753

    hi - thanks for this, this

    hi - thanks for this, this addresses the limitations in the existing swfobject module for drupal, as it only seems to work with blocks.

    one issue - it would well be named something else - as someone installing both modules, would have obvious problems (not that both should be needed).

    cheers! just about to install. ill see if i can use both, with a rename.

    a.

    Yes, it's actually been

    Yes, it's actually been renamed in drupal cvs- see the swfobject_api module

    thanks!

    Hi arthur, What about

    Hi arthur,

    What about adding Flashvars, like:

    so.addVariable(”audio1″, “music1.mp3″);
    so.addVariable(”audio2″, “music2.mp3″);
    so.addVariable(”audio3″, “music3.mp3″);

    can you amend the code to include this in the procedure call, ie.:

    print swfobject_create($url, $params, $vars);

    i have amended to handle

    i have amended to handle flashvars:

    http://www.angurio.com/code/swfobject_amended.tgz

    syntax is:

    print swfobject_create($url, $params, $vars);

    adds:

    so.addVariable(”audio1″, “music1.mp3″);

    very useful for flv playback - i.e.

    $vars = array('$path' => 'http://www.url.com/flv.flv');

    a.

    Post new comment

    The content of this field is kept private and will not be shown publicly.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
    • Lines and paragraphs break automatically.

    More information about formatting options