Flash embed code - Validates as STRICT
When you publish your flash movie and flash produces a html page, you’d think, cool the code has all been done for me. But you’re wrong. Very wrong. This code flash produces will not validate in transitional markup, let alone strict.
Now there are many bits of code floating around that validate transitional. And not so many that validate strict.
I have made my own bit of code, using elements from various sources around the web. I can only thank those before me who done all the hard work.
One major issue i had was when using flash in Wordpress installations. Many of my movies involve loading additional swf’s to reduce load time using relative urls. This is a problem in Wordpress as the flash file doesn’t actually know where it is, so relative url’s will not work. Relative to what, flash thinks.
As mentioned in a previous article this involves using the “base” attribute.
But enough of that, here is the flash embed code that validates as “strict”. I have added the php code that rewrites the wordpress site urls for you. Remove this if your not using wordpress.
<div id="flash_embed">
<div>
<object data="<?php bloginfo('stylesheet_directory'); ?>/your_flash_movie.swf" type="application/x-shockwave-flash" width="960" height="130">
<param name="movie" value="<?php bloginfo('stylesheet_directory'); ?>/your_flash_movie.swf" />
<param name="wmode" value="transparent" />
<param name="base" value="http://www.your_domain.com/absolute_url_to_your_flash_movie" />
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/flashreplace.gif" width="760" height="150" alt="replacement flash" />
</object>
</div>
</div><!--flash_embed-->
Ooo, lastly… This code requires no JavaScript! Those without flash, will get an image replacement instead (which you need to upload to your images folder). Fair enough, they wont get a “get flash here message”, but with flash at almost 99% penetration, in my view it’s not needed.
Hope it’s helpful.







