Drupal Association members fund grants that make connections all over the world.
Under SWF Tools 6 the function is changed slightly to make it more akin to other Drupal 6 function that take optional parameters. So instead of passing a series of individual parameters you pass the filename, followed by an optional associative array, with optional keys params, flashvars, othervars and methods.
SWF Tools 5
swf($file, $params = FALSE, $flashvars = FALSE, $othervars = FALSE, $methods = FALSE);
SWF Tools 6
swf($file, $args = array());
$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.
$args (Drupal 6, optional): An associative array of arguments. This is in line with the Drupal 6 methodology and is a replacement for the "$params, $flashvars, $othervars" method of declaring arguments. The available keys are 'params', 'flashvars', 'othervars' and 'methods'. See the appropriate Drupal 5 arguments below for more on these.
$params (Drupal 5, optional): An associative array of variables to set e.g.
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. Note - this autodetection process only works for local files, not remote url's. Possible $params are width, height, version, wmode, bgcolor, scale, quality, name, base, align, salign, allowfullscreen.
Be careful of the change with SWF Tools 6! As noted above, the way to supply this argument is to use 'params' as a key in the $args array. For example, the proper way to set the width and height is:
print swf('myMovie.swf', array('params' => array('width' => '200', 'height' => '200')));
$flashvars (Drupal 5, optional): An associative array of flashvar variables to set. eg.
array('playlist' => 'files/my_playlist.xml')
$othervars (Drupal 5, 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 (Drupal 5, optional): Explicitly declare an action, player or action by passing an array of the form:
If you don't specify an explicit value then SWF Tools will use its defaults and determine an appropriate action (e.g. play an mp3 with the configured player, using the selected embedding method). It is not necessary to supply every parameter - e.g. to over-ride only the embedding method set just that key and value. A list of available action, players and methods (and their names) are summarised in the SWF Tools filter documentation.
A string containing the HTML output to embed the flash file.
There is sometimes confusion about how to use the swf() syntax, so there are some examples below to try and clear things up.
SWF Tools 5
Render an flv file, passing height and width parameters, and a flash var to set the thumbnail image.
print swf('test1.flv', array('width' => '400', 'height' => '300'), array('image' => 'picture.jpg') );
SWF Tools 6
Render an flv file, passing height and width parameters, and set the thumbnail image on othervars, so all players can find it.
print swf('test1.flv', array( 'params' => array('width' => '400', 'height' => '300'), 'othervars' => array('image' => 'picture.jpg'), ) );