well, Using SWFObject is easy. Simply include the swfobject.js Javascript file, then use a small amount of Javascript on your page to embed your Flash movie. Here is an example showing the minimum amount of code needed to embed a Flash movie:
<script type="text/javascript" src="swfobject.js"></script>
<di v id="flashcontent">
This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
so.write("flashco ntent");
</script >
Here is a breakdown of what the code does:
<div id="flashcontent">[...]</div>
Pr epare an HTML element that will hold our Flash movie. The content placed in the ‘holder’ element will be replaced by the Flash content, so users with the Flash plug-in installed will never see the content inside this element. This feature has the added bonus of letting search engines index your alternate content.
var so = new SWFObject(swf, id, width, height, version, background-color [, quality, xiRedirectUrl, redirectUrl, detectKey]);
Create a new SWFObject and pass in the required arguments:
* swf - The file path and name to your swf file.
* id - The ID of your object or embed tag. The embed tag will also have this value set as it’s name attribute for files that take advantage of swliveconnect.
* width - The width of your Flash movie.
* height - The height of your Flash movie.
* version - The required player version for your Flash content. This can be a string in the format of ‘majorVersion.minorVersion.rev ision ’. An example would be: "6.0.65". Or you can just require the major version, such as "6".
* background-color - This is the hex value of the background color of your Flash movie.
Optional arguments are:
* quality - The quality you wish your Flash movie to play at. If no quality is specified, the default is "high".
* xiRedirectUrl - If you would like to redirect users who complete the ExpressInstall upgrade, you can specify an alternate URL here
* redirectUrl - If you wish to redirect users who don’t have the correct plug-in version, use this parameter and they will be redirected.
* detectKey - This is the url variable name the SWFObject script will look for when bypassing the detection. Default is ‘detectflash’. Example: To bypass the Flash detection and simply write the Flash movie to the page, you could add ?detectflash=false to the url of the document containing the Flash movie.
so.write("flashconte nt");
Tell the SWFObject script to write the Flash content to the page (if the correct version of the plug-in is installed on the user’s system) by replacing the content inside the specified HTML element.
The Details
SWFObject works quietly in the background of your HTML document. When developing pages that use SWFObject, you should start with your alternate (non-Flash) content first. Get your pages working without your Flash movies, then add them in later with little Javascript snippets that replace your alternate content with the Flash movies. This ensures that the alternate content will be indexed by search engines, and that users without the Flash plug-in will still see a working HTML page. Whether you provide upgrade instructions or not is up to you. If your alternate content can suffice, there may be no reason at all to tell people they are missing out on Flash content.
SWFObject works in all the current web browsers, including, on PC: IE5/5.5/6, Netscape 7/8, Firefox, Mozilla, and Opera.
Answered by
Satya ~
, an ibibo Master,
at
5:15 PM on July 07, 2008