Modern browsers make it easy to add an SWF banner to your website. In the past, you had to write lengthy HTML code to embed SWFs on Web pages. An SWF file is one that your Flash player plays when you visit a site that uses Flash. Because newer versions of HTML don’t require you to use the outdated "<embed>" tag to put an SWF on your Web page, you can add one quickly using a single line of code.
View Your Web Page’s HTML
Before you put your SWF banner on your live website, you can test it in a local copy of your HTML document that resides on your computer. Testing it locally enables you to customize the HTML quickly without having to upload it to the Web server that hosts your website. Launch your HTML editor or Notepad, and then find the document's opening "<body>" tag and its closing "</body>" tag. These two tags define the document’s body section, and anything you place between those tags appears on your Web page. For instance, if you type "hello" after the opening "<body>" tag, you see that word at the top of your Web page if you view it in a browser.
Add Your SWF Banner
Paste the following in the body section where you want your banner to appear:
Replace "my_swf.swf" with the URL to the SWF you’d like to embed, whether it resides on someone else’s website or your own Web server. After you save your HTML document, launch your browser, and then press “Ctrl-O” to display a window that lists your hard drive’s files. Double-click the HTML document you saved to load it into the browser and see the SWF banner you embedded.
Tweak Your Banner's Dimensions
HTML gives you the ability to make objects larger or smaller. The basic "<object>" tag you used to embed your SWF does not have any height or width attribute -- which is OK, because the banner will display at its default size. For instance, if it’s 300 pixels wide and 80 pixels tall, that’s how it will appear in a browser. To change the banner’s height and width, paste the following before the word "data" in the code you added:
Replace 100 with the desired height and 400 with the width you’d like. Those values are in pixels. When you’re done, your code should look like this example:
<object height="100" width="400" data="my_swf.swf"></object>
Add It to Your Website
You can place your SWF banner anywhere you like on your Web page. However, more people may notice it if you put it at the top of the page after the HTML document’s opening "<body>" tag. Don’t make the banner too wide if you don’t want the width to exceed the typical site visitor’s browser width. For instance, if you make the width 1200 pixels, the banner may be too wide for some people to see without scrolling. After you get your banner looking the way you like, you can upload your HTML page to the Web server that hosts your website. To create a new SWF banner, visit a site such as 123-Banner.com or BannerSnacks for help in generating one automatically (see Resources).
- Jupiterimages/Stockbyte/Getty Images