Downloads » Resources » SWFObject » SWFObject | 1.0.3

SWFObject 1.0.3

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
2 vote(s).

Embeds Flash content using SWFObject 2 script (formely SWFFix).

Works with MODx Version(s): All
Submitted: May 12th 2008 | License: None Specified | Downloads: 217

Description

Embeds Flash content using SWFObject 2 script (formely SWFFix) from Geoff Stearns, Michael Williams and Bobby van der Sluis.
More information about this script can be found at http://code.google.com/p/swfobject/.
The snippet inserts all necessary HTML markup.

Note: This version embeds SWFObject 2.0 final release.

Instructions

Install instructions

  • Upload the "swfobject" folder and all its contents to the "assets/snippets" folder in your MODx installation.
  • Into the MODx Manager, copy the contents of the file "swfobject.snippet.php" into a new snippet named "SWFObject".


Parameters

Required
&swfFile [string]
Path or URL of the SWF file to embed.
&flashVersion [string]
Flash player version the SWF file is published for, specified as : major.minor.release (major.minor or major don't work).
&mode [static | dynamic]
Way to use SWFObject script: static publishing (option 1) or dynamic publishing (option 2).
Refer to http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation for details.
&objId [string]
ID of the HTML <object> element that will contains the Flash content.
In case of dynamic publishing (option 2), it is also the ID of the HTML <div> element containing the alternative content before Javascript replacement.
&objWidth [integer]
Width of the SWF file.
&objHeight [integer]
Height of the SWF file.

Optional
&altContent [string]
Alternative content if Flash player is not installed. In case of dynamic publishing (option 2), it is also displayed if Javascript is disabled.
Can be either a chunk name or HTML code.
Defaults to:
<p>Please download Flash player <a href="http://www.adobe.com/go/getflashplayer">here</a>.</p>

&objAttr [comma-separated list of name:"value" pairs]
Attributes for the outer HTML <object> element that will contains the Flash content.
&flashParam [comma-separated list of name:"value" pairs]
Parameters for the nested HTML <object> elements that will contains the Flash content, that will be inserted with <param> tag.
&flashVars [comma-separated list of name:"value" pairs]
Flashvars, that will be inserted with <param> tag as a parameter for the nested HTML <object> elements that will contains the Flash content.
&configFile [string]
Path of a config file which specifies snippet parameters value.
This file must be a PHP file using the following syntax for each parameter:
$param = 'value';


Examples

Minimal call with only required parameters:
[!SWFObject? &mode=`static` &flashVersion=`7.0.0` &objId=`myFlashContent` &objWidth=`380` &objHeight=`300` &swfFile=`assets/flash/myfile.swf`!]
[!SWFObject? &mode=`dynamic` &flashVersion=`7.0.0` &objId=`myFlashContent` &objWidth=`380` &objHeight=`300` &swfFile=`assets/flash/myfile.swf`!]

Using &altContent parameter:
[!SWFObject? &altContent=`<p>Alternative content</p>` &mode=`static` &flashVersion=`7.0.0` &objId=`myFlashContent` &objWidth=`380` &objHeight=`300` &swfFile=`assets/flash/myfile.swf`!]
[!SWFObject? &altContent=`myChunkName` &mode=`static` &flashVersion=`7.0.0` &objId=`myFlashContent` &objWidth=`380` &objHeight=`300` &swfFile=`assets/flash/myfile.swf`!]

Using &objAttr, &flashParam, &flashVars parameters:
[!SWFObject? &objAttr=`class:"first second", name:"myname"` &flashParam=`quality:"high", bgcolor:"0x000000"` &flashVars=`myvar:"myvalue", othervar:"othervalue"` &mode=`static` &flashVersion=`7.0.0` &objId=`myFlashContent` &objWidth=`380` &objHeight=`300` &swfFile=`assets/flash/myfile.swf`!]

Using &configFile parameter:
[!SWFObject? &configFile=`assets/site/my_flash_content.config.php`!]
Config file contents:
<?php
$mode = 'dynamic';
$flashVersion = '7.0.0';
$objId = 'myFlashContent';
$objWidth = '380';
$objHeight = '300';
$swfFile = 'assets/flash/myfile.swf';
$flashParam = 'quality:"high"';
?>

Updates

Added "defer" attribute to <script> tags, as suggested by forum users dev_cw and elz64


( back to top )