I'm quite disappointed that I had to dig into the module code to determine the optional syntax of this function.

The notes in the module are very helpful, but the lack of anything (easily found) on the web or any kind of a readme file makes it difficult to work out how to achieve anything beyond the most basic swf(filename) functionality as described on the project home page.

I've transcribed some of the code notes in a api.drupal.org sty-lee, feel free to incorporate this into some kind of future documentation. I've included information on available $params keys but this was mostly guesswork after trawling through the code (which is one of the main reasons I'm posting this ;) so it would be best if one of the module team could look it over.

Definition

swf($file, $params = FALSE, $flashvars = FALSE, $othervars = FALSE, $methods = FALSE);

Description

Return output, which might be embed markup, or pre-flash markup that includes the appropriate jQuery added to the

Parameters

$file (required): The file to be played. If it is a SWF file it will usually be embedded directly. Use a full URL, a path relative to webroot, or a path relative to the configured files directory.

$params (optional): An associative array of
variables to set.eg. array('bgcolor'=>'FF00FF')
To set height and width: array('width'=>'200', 'height'=>'120'). However, as a convenient alternative for the common requirement of just height and width you can also pass a text string like '200x100'. If you pass nothing, and the file to play is a .swf, swftools will try and establish a natural width and height from the actual .swf file that you've passed into $file.
Possible $params: width, height, version, wmode, bgcolor, scale, quality, name, base, align, salign

$flashvars (optional): An associative array of flashvar variables to set. eg. array('playlist'=>'files/my_playlist.xml')

$othervars (optional): An associative array of variables that might be required by the $player or $embed technique.
These values are not output as params or flashvars.
Available $othervars include: html_alt, playlist_data, id, class

$method (optional): Explicitly declare an action, player or action by passing an array of the form: array('action'=>'dosomething','player'=>'withsomething','embed'=>'withthisjavascript').
These usually default to the administration settings and also you will usually use a CONSTANT which will be documented further at a later stage.

Return value

A string containing the HTML output to embed the flash file.

Comments

carldnelson’s picture

So, could you give a specific example of how I could use this info to set one of the parameters like a background image for the flv file?
Thanks,
Carl

Stuart Greenfield’s picture

Status: Active » Closed (fixed)

Thanks for posting this issue! I have taken the content, adjusted it a little bit, and used it to create a handbook page for the swf() syntax.

I'm setting this issue to closed as a result.

@carldnelson - generally to set a background image for an flv file you pass a flash var to the player to tell it what image you want to use. The name of the variable varies between players, but is typically something like image.

So in general you would call the swf() function, and as part of the flashvars array pass the key/value pair for you image, e.g. 'image' => 'myBackgroundImage.jpg'.

prezaeis’s picture

anyone know how to get the equaliser to properly how on mp3 songs?
im using this code below but the EQ isnt showing!

<?php print swf($node->field_mp3_upload[0]['filepath'], 
					array
						(
						  'flashvars' => array
						  				(
										 'image' => 'http://www.mysite.com/' . ($node->field_content_image[0]['filepath']),
										 'showeq' => 'true',
          )
        )); ?>