How to Embed a SWF to Play on Click

Add a funny Flash animation to emphasize your blog post.
... BananaStock/BananaStock/Getty Images

Flash animation provides your website visitors with rich and engaging interactive content. Once you've created the content, export it to SWF format and upload the file to your host server. A few lines of code will embed the file in your website so it automatically plays when the page loads. To disable this autoplay functionality, add parameters to the script -- which are essentially limitations for the element you're working with -- so the Flash file only begins when the user clicks "Play."

Log in to the administrative controls of your website or blog. Upload the SWF file to the server or multimedia library.

Launch the HTML editor for the page in which you're embedding the Flash element. Alternatively, you can download the HTML file and open it offline in a text editor like WordPad or TextEdit.

Place your cursor in the location on the page where you'd like to add the Flash element. Add several hard returns -- in other words, press the "Enter" button -- to clear your workspace. This will not affect the formatting of the page.

Copy and paste the following code, replacing "FILENAME" with your SWF's file name. You can also modify the video player's dimensions -- in both the first and fourth line of code -- if you prefer a smaller or larger viewing window.

<object width="320" height="240"> <param name="movie" value="FILENAME.swf"> <param name="autoplay" value="false"> <embed src="FILENAME.swf" width="320" height="240"> </embed> </object>

Save the HTML code and preview your changes on the site to ensure your video plays only when you click the "Play" icon.

  • Flash videos are not supported by all operating systems, so it may be prudent to convert the file to an HTML5-compliant format -- like MP4, which is universally compatible -- before embedding it in your site.
  • If your website or blog features a WYSIWYG editor, you may be able to embed the SWF file and disable autoplay without having to manually access the HTML coding. These types of editors don't require programming knowledge and look like a word processing app instead of a plain text editor. WYSIWYG -- or "What You See Is What You Get" -- editors automatically format the HTML code for you, adding features like bolded text, alignment modifications, embedded images and hyperlinks.

Based in Tampa, Fla., Danielle Fernandez been writing, editing and illustrating all things technology, lifestyle and education since 1999. Her work has appeared in the Tampa Tribune, Working Mother magazine, and a variety of technical publications, including BICSI's "Telecommunications Distribution Methods Manual." Fernandez holds a bachelor's degree in English from the University of South Florida.