The embed element can write a Flash file into HTML. To include an SWF file in a page using an embed element, you can use the following sample markup:
<embed src="flash_file.swf" width="500" height="400"/>
The "src" attribute lists the name of the SWF file. The embed tag typically also lists additional attributes, optionally including one to control autoplay as follows:
<embed src="flash_file.swf" width="500" height="400" play="false"/>
The "play" attribute specifies that the SWF should not automatically play when it is loaded.
The HTML object element allows Web pages to include SWF files. The following syntax snippet demonstrates the markup:
<object width="500" height="400"> <param name="movie" value="flash_file.swf"/> <!--other parameters--> </object>
With the object element, parameters are listed using "param" tags. To stop automatic playing, you can include the "play" parameter inside the object element:
<object width="500" height="400"> <param name="movie" value="flash_file.swf"/> <param name="play" value="false"/> </object>
The "param" element with "play" as its name attribute lists the parameter using a name value pair.
var swfObj = new SWFObject("flash_file.swf", "swfmovie", "500", "400", "8", "#FFFFFF"); //set other properties swfObj.write("swfmovie");
To set the autoplay property, you can extend the sample code as follows:
var swfObj = new SWFObject("flash_file.swf", "swfmovie", "500", "400", "8", "#FFFFFF"); swfObj.addVariable("autostart ","false"); swfObj.write("swfmovie");
The "autostart" variable sets autoplay to false.
- BananaStock/BananaStock/Getty Images