I was surprised to not be able to find anywhere on this site something that works like theme_image ...but for flash. Does anyone have a prefab helper function to generate the necessary flash HTML code for a specified swf file url, and optional handling for say, flash version, wmode, and width, height and other standard html_attributes? A la....

function theme_flash($url, $version = '6,0,40,0', $attributes = NULL)

If no one has this, then what might be the most common flash variables needed to create a solid widely usable function? Perhaps the $attributes could include standard html attributes, and some special cases like:

  • width & height attribs needed for object and embed tags. May be better to make these required function args?
  • bgcolor .... if 'transparent' add the wmode='transparent' attribute else add param bgcolor

Your thoughts?

Comments

mokargas’s picture

I'm not sure if this is core functionality due to the fact that flash can possibly evolve quicker than the humble image.

You could create a nice module to do this, even use the SWFObject API module (http://drupal.org/project/swfobject_api) to make it rather easily.

jwilson3’s picture

...thats pretty much exactly what I was looking for.

However, as to your argument against why its not in core, it seems that although the flash or video format may perhaps evolve faster than static image formats, generating the HTML to /embed/ an object still has to live within the well-defined realm of HTML document tags, browser plugins and external proprietary rendering libraries, that aren't going to change overnight. I don't see how to measure evolution of the IMG tag, versus the de-facto "VIDEO" tags (aka OBJECT, PARAM, EMBED). Evolution of this stuff is dependent on evolution of HTML as far as i can see. correct me if I'm wrong tho.

mokargas’s picture

Hmm, a good point. I wonder what the core developers reasoning would be for that, there's bound to be some good reasons - or maybe it's a simple oversight?

Luckily Drupal's module system is nice and easy to make it all happen :)

arthurf’s picture

SWFTools provides a more comprehensive set of tools for dealing with flash. The SWFObject API module will be merged into SWFTools in the near future.