Bookmark and Share

Flash HTML Code

Before we get started into the nuts and bolts of Macromedia Flash let's figure out exactly how you insert Flash files (.swf file extension) into your existing HTML files. To follow along with this tutorial you are going to need a flash file, a web page, and some time on your hands. If you think you've got all those items assembled then we can begin.

Advertise on Tizag.com

Inserting Flash Into HTML

To insert flash into your HTML files you must use the HTML tag object, which is used to place multimedia items like music, movies, and now Flash files onto web pages. We will assume that the name of your flash file is "example.swf" for this lesson, but you should rename it to the actual name of your flash file.

Embed Flash: <object> Tag

The object tag contains many attributes to modify the way the multimedia is displayed and to describe the type of media to be displayed.

Below is the cookie cutter HTML code you can use to insert a flash file into any HTML page, assuming that both this HTML file and Flash file are in the same directory.

Note: The only pieces you need to change are value and src, which specifies the name and location of your Flash file and height and width, which specify the dimensions of your Flash file.

HTML Code:

<html> 
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab#version=6,0,40,0"
width="468" height="60"
id="mymoviename">
<param name="movie"
value="example.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="example.swf" quality="high" bgcolor="#ffffff"
width="468" height="60"
name="mymoviename" align="" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">

</embed>
</object>
</body>
</html>

Display:

Macromedia has written a description of this complex bit of HTML Code, so check it out if you like to get into the details.

Macromedia Flash has a feature to automatically generate the necessary HTML Code. To generate the HTML code and Flash file for your project go to the Flash menu File < Publish.

If the flash file is in a different location you could instead type the complete URL of the flash file as we have done in this second example:

HTML Code:

<html> 
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab#version=6,0,40,0"
width="468" height="60"
id="mymoviename">
<param name="movie"
value="http://www.tizag.com/pics/example.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="http://www.tizag.com/pics/example.swf" quality="high" bgcolor="#ffffff"
width="468" height="60"
name="mymoviename" align="" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">

</embed>
</object>
</body>
</html>

Display:

Bookmark and Share




Found Something Wrong in this Lesson?

Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!

Advertise Here

More Tutorials!
Microsoft Office Tutorials Artist Tutorials