Validate Flash Markup

The software I use is Dreamweaver 8, Swish Max and some Flash. I have been
on a mission to figure out how to validate the code that these software packages
generate for web pages. I am no expert, but have been hoping that someone
who knew a lot more about how browsers work would come up with a solution.
I knew that w3c only supports the “object” tag, yet Mozilla-based browsers only support the “embed” tag,
so to make the code validate would result in the Macromedia Flash not displaying
in Mozilla.

Sample Code generated by software programs:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs
/flash/swflash.cab#version=5,0,42,0"
id="flash" width="200" height="200" />
<param name="movie" value="flash.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#FFFFFF" />
<embed name="Movie1" src="flash.swf"
quality="high" bgcolor="#FFFFFF" swLiveConnect="true"
width="200" height="200"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>

On one of my web design lists, I asked if anyone had found a solution. The first response came from Cranium Creations:

<object type="application/x-shockwave-flash"
codebase="http://download.macromedia.com/pub/shockwave/cabs
/flash/swflash.cab#version=6,0,79,0"
data="http://www.websitename.com/flash.swf" width="200px" height="200px"/>
<param name="movie" value="http://www.websitename.com/flash.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="scale" value="100%" />
<a href="http://www.macromedia.com/go/getflashplayer"
title="link to the Macromedia Flash Player download page">Get the latest
Flash Player from Macromedia</a>
</object>

This validates just great. But in IE it places a small graphic box (that looks like what happens when you don’t upload an image but have it in the code) in the upper left corner of the Flash object on the page until the Flash loads. For most sites that I create, that is not a huge problem, but I felt like to get the page to validate, I created a different problem. I have a larger Flash file on one web site that requires a preloader, and all the page would show was the little color graphic until after the preloader had virtually loaded the movie. Since the majority of the viewers on this particular site would be using IE, I felt I needed a better solution.

I plodded on and found a post on A List Apart (http://www.alistapart.com/articles/flashsatay/ — please refer to to that link for the details). This is a great explanation of the various elements of the Flash code generated by the software programs, but I still had a problem with being able to create the Flash necessary by using SwishMax:

<object type="application/x-shockwave-flash"
data="c.swf?path=flash.swf" width="200" height="200" />
<param name="movie" value="c.swf?path=flash.swf" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<img src="images/byline.jpg" width="200" height="200" alt="" />
</object>

I could not get SwishMax to create the container movie above, “c.swf”,
correctly, as it would not take the variable passed to it from the path=flash.swf.
I had to use Macromedia Flash to create the container movie (if someone
knows how to get it to work in SwishMax, I would certainly welcome the
comment!).

(Side Note: the wmode parameter above allows a menu to drop down over the
Flash object.)

This does not totally finish the Flash code though, as now there is no way
to detect the Flash Player (or version). The suggestion is to create an
empty Flash object somewhere else on the page and add in the flash detection
code, which can be accomplished quite simply with the code supplied above
by Cranium Creations.

However, if you don’t care about Flash detection, the img src in the code

above will place a static image on the page instead of the Flash.

The above code has been tested on a PC in IE 6, FireFox 1.5, and Opera 7,
and on a Macintosh in IE 5.2 and FireFox.

I think it is interesting at best to see that Drew McClellan’s quest up at
A List Apart was to condense the markup because he didn’t like the bloated
code generated yet Cranium Creations was because he wanted it to validate
in XHTML.

Now if someone could figure out for me how to make the Windows Movie Videos
load in Mozilla without using the embed command, that would really make
me happy!

This entry was posted in Coding, Valid Code. Bookmark the permalink.

One Response to Validate Flash Markup

  1. Judy says:

    All the above has been made obsolete by the introduction of the swfobject with information that can be found at http://blog.deconcept.com/swfobject/.

    This is a great way to use flash in your websites as you can add a description of your flash object in your html and it will help with search engine optimization.

    It completely eliminates the need to use the embed tag so your pages will validate to the w3c standards too.

Comments are closed.