Join or Login

Getting Flash to Validate

by me


I don’t know about you, but I am a validation junkie. If my website code doesn’t validate I get the shakes, cold-sweats, sometimes get delusional, and get angry for no reason. I really do not understand why embed is even used, well sure it’s a small neat code to throw on a website, but anyone can easily modify the code to w3c standards. If I can do it why can’t the big boys do it too?

Here is how I put flash embeds on my website. We’ll use Youtube for an example.

standard Youtube embed code -

<object width=”425″ height=”355″>
<param name=”movie” value=”http://www.youtube.com/v/50nHCo2n4Tw&rel=1″></param>
<param name=”wmode” value=”transparent”></param>
<embed src=”http://www.youtube.com/v/50nHCo2n4Tw&rel=1″ mce_src=”http://www.youtube.com/v/50nHCo2n4Tw&rel=1″ type=”application/x-shockwave-flash” wmode=”transparent” width=”425″ height=”355″></embed>
</object>

The trick to modify this code is to seperate all the embed attributes and then delete the embed tag from start to finish. Now go to your object tag and add the attribute data=”http://www.youtube.com/v/50nHCo2n4Tw&amp;rel=1″ ( anytime you see an “&” replace it with “&amp;”) and type=”application/x-shockwave-flash”. Now you can go into the “param” tags, add a backslash before the “>” delete the closing “</param>”tags. So you get something like this -

<object data=”http://www.youtube.com/v/50nHCo2n4Tw&amp;rel=1″ width=”425″ height=”355″ type=”application/x-shockwave-flash” >
<param name=”movie” value=”http://www.youtube.com/v/50nHCo2n4Tw&amp;rel=1″ />
<param name=”wmode” value=”transparent”/></object>

Here it is in action

If you want to get into more difficult codes we’ll use the Whos.Amung.Us map widget, like I have in the footer of my website. The original code looked like this -

<embed src=”http://maps.amung.us/flash/flashsrv.php?k=” mce_src=”http://maps.amung.us/flash/flashsrv.php?k=”get your own id”&type=em.swf” quality=”high” pluginspage=”http://www.macromedia.com/go/getflashplayer” allowScriptAccess=”always” allowNetworking=”all” type=”application/x-shockwave-flash” flashvars=”wausitehash=”get your own id”&map=green&pin=target-green&link=yes” width=”200″ height=”135″ />

Now there isn’t even an “object” or a “param” tag, but that is o.k.. First thing I did was erase the black sheep “embed” tag. You only have to put the “src”,”height”,”width” and “type” in the object tag, but change “src” to “data”. Basically you will take all the attributes of the embed tag and put them in param tags like this <param name=”embed attribute” value=”embed attribute value” />.You will get something like this -

<object data=”http://maps.amung.us/flash/flashsrv.php?k=”get your own id”&amp;type=em.swf”
width=”200″ height=”135″ type=”application/x-shockwave-flash”>
<param name=”src” value=”http://maps.amung.us/flash/flashsrv.php?k=”get your own id”&amp;type=em.swf” />
<param name=”quality” value=”high”/>
<param name=”pluginspage” value=”http://www.adobe.com/go/getflashplayer”/>
<param name=”allowScriptAccess” value=”always”/>
<param name=”allowNetworking” value=”all”/>
<param name=”type” value=”application/x-shockwave-flash”/>
<param name=”flashvars” value=”wausitehash=”get your own id”&amp;map=green&amp;pin=target-green&amp;link=yes”/>
</object>

If you look in the footer of this web page you will see it in action.

You can check for yourself about validity –>

Valid XHTML 1.0 Transitional

12 Responses to “Getting Flash to Validate”

  1. Techy News » Blog Archive » Getting Flash to Validate Says:

    [...] Read the rest of this great post here [...]

  2. delbeeny Says:

    Thanks

  3. kuttur Says:

    I’m very interested in topics like that, but this one sounds especially truthful, and I really trust the source where it came from. Sooner or later it was going to come out and it finally did!

  4. Jerry Galino Says:

    Hi there Finally I found a site the has some good information on Validate Xhtml. I was searching around and found your post Flash to Validate | The H8ers Club, thanks for the good info..I\’ll be checkin back soon.

  5. Gary Badger Says:

    Hi there. Great article. I’m a validation junkie too. I’m really struggling with this simple code to validate as strict:

    The validator continually reports:
    1. document type does not allow element “param” here; assuming missing “object” start-tag.
    2. XML Parsing Error: Opening and ending tag mismatch: div line 15 and object. [this was the object end tag]
    ….which I know is wrong.

    HTML Tiday (in Firefox) tells me:
    1. Warning: discarding unexpected
    2. Warning: discarding unexpected

    Any ideas, please?

  6. Gary Badger Says:

    Ahh nuts, you’ve stripped the HTML from my post. Fair enough.

    Here is the code again using braces…

    {object type=”application/x-shockwave-flash” data=”http://www.mp3asset.com/swf/mp3/myflashfetish-mp3-player.swf” width=”218″ height=”155″ /}
    {param name=”flashvars” value=”myid=1971340&path=2007/04/15&mycolor=&mycolor2=&mycolor3=&autoplay=&rand=0&f=3&vol=100&pat=” /}
    {/object}

  7. me Says:

    it’s right there you are closing your first object tag i.e.{object/} leave it open
    <object type=”application/x-shockwave-flash” data=”http://www.mp3asset.com/swf/mp3/myflashfetish-mp3-player.swf” width=”218" height=”155" >
    <param name=”flashvars” value=”myid=1971340&path=2007/04/15&mycolor=&mycolor2=&mycolor3=&autoplay=&rand=0&f=3&vol=100&pat=” />
    </object>

  8. me Says:

    just did a check and if the the code is wrapped in div tags it validates for xhtml strict

  9. Gary Badger Says:

    Thanks so much. I’ve had one of those “D’oh!” moments. I guess I was looking at the code so much that I missed the obvious problem.

    Yes, I was effectively closing the object tag twice.

    I appreciate your guidance.
    Cheers,
    Gary.

  10. Eli Says:

    Hi Me:

    I followed your code to get the amung.us widget to validate in XHTML 1.0 Strict and it validates, but the widget doesn’t work on my website. I just get “No Visitors” on my map when I visit my own website with the amung.us map on it. I even tried creating a super-basic web page with just the opening and closing html tags and body tags and the validated amung.us code according to your format using my amung.us widget and it still doesn’t record any visitors when I’m on the page. I’m at a public library now. When I put on the original embed code for the amung.us widget, it displays the map point where I’m located (still at the public library), but when I use the XHTML 1.0 validated code exactly as you present it in the order that you present the object tag and its attributes and the parameters and their values, I only get “No Visitors”. Seemingly bizarre. Any ideas on what might be causing this? I’d love to finally resolve this once and for all as I’ve been working on this for a couple of weeks and finally came across your web page which specifically discusses the amung.us code and XHTML 1.0 validation. I’ve supplied the super-basic web page containing only the amung.us widget code in my posting here. Thank you very much for any help in this matter.

    Sincerely, Eli.

  11. me Says:

    hi eli,
    I get that every once in a while especially if I write a new article, it usually resolves itself. If you right click this page and view source you will see the code I used and it is the same as the example. The thing I don’t like about the amung us widget is that it can sometimes slow down my page load time. I contacted amung us when I first wrote this article and showed them my valid method for getting their widget to validate and they said it was ok to use their info this way. Well, to me anyways. It could also be that their server is busy at the time, but I am sure they probably use a innodb table scheme, if they use mysql, with row level locking. I see a bunch of green stars on my site, so patience.

  12. me Says:

    @eli I have made a test page with both codes on it
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
    <title>Amung us embed vs. object round 1</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    </head>
    <body>
    <!-- commented out to not show errors when we validate it
    <div>
    <p>
    Original Code from amung_us website
    </p>
    </div>
    <div>
    <embed src="http://maps.amung.us/flash/flashsrv.php?k=”get your own id”&type=em.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" allowNetworking="all" type="application/x-shockwave-flash" flashvars="wausitehash=”get your own id”&map=green&pin=spinner-green&link=yes" width="200" height="135" />
    </div> -->
    <div>
    <p>
    Xhtml 1.0 strict object code
    </p>
    </div>
    <div>
    <object data="http://maps.amung.us/flash/flashsrv.php?k=”get your own id”&type=em.swf"
    width="216" height="165" type="application/x-shockwave-flash">
    <param name="movie" value="http://maps.amung.us/flash/flashsrv.php?k=”get your own id”&type=em.swf" />
    <param name="flashvars" value="wausitehash=”get your own id”&map=green&pin=spinner-green&link=yes" />
    <param name="quality" value="high" />
    <param name="pluginspage" value="http://www.adobe.com/go/getflashplayer" />
    <param name="allowScriptAccess" value="always" />
    <param name="allowNetworking" value="all"/>
    <param name="type" value="application/x-shockwave-flash" />
    </object>
    </div>
    </body>
    </html>

    if you open this file with firefox and uncomment the embedded script. you can see they are both the same.

Leave a Reply

Powered by WordPress