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:
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:
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:
With the object element, parameters are listed using "param" tags. To stop automatic playing, you can include the "play" parameter inside the object element:
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