Insert Flash The Correct Way

Quick Tip: Insert Flash the Correct Way

Tutorial Details
  • Difficulty: Beginner
  • Completion Time: 15 Minutes

You create your site the right way. You follow all of the rules, so that in the end, you can proudly have a link to w3′s validator, confirming your site’s perfection. There’s just one problem: if you embed any flash into your page, you’ll get several errors. That’s because the embed tag is not a valid tag. You need to insert your flash the correct way!

What Not To Do

<embed
src="player.swf"
width="300"
height="300"
allowscriptaccess="always"
allowfullscreen="true"
/>

This is the simplified version. If you generate the default HTML web page directly from flash, it’s ten times more ugly. In fact, it just might be longer than this article – Just to embed a single flash file! And it doesn’t even do it with valid HTML (in fact 19 errors).

Errors

This is the result. As you can see, there are 6 errors. All 6 from the embed element (5 from the
attributes, and 1 from the tag itself)

What You Should Do

First of all, you shouldn’t use the embed tag at all. Forget it! Since we don’t have “embed” any more, we’re only left with the object tag. It’s a good thing that all browsers support it in some way!

Within the Object tag we will use the following attributes:

type=”"

data=”"

width=”"

height=”"

We’ll need to specify the MIME type of what we’re inserting. In this case, we’re inserting flash. So for the type attribute, we specify “application/x-shockwave-flash”. We declare the source through the data attribute. I think everyone can guess what the width and height attributes do. So this is how you should insert your flash, for validity:

<object
type="application/x-shockwave-flash"
data="flash.swf"
width="750" height="400">
<param name="movie"
value="flash.swf" />
</object>

You still need the <param> tag as well. Let’s test this new code now:

Validated

Final Words

Isn’t that “congratulations page” just so…validating? No pun intended. Anyway, I hope you found this to be useful, and have a great week!

Tags: Flash
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • fmloftvjayF

    [url=http://wicketstuff.org/confluence/display/~ultram4rt]ultram pain management ededgonzalez [/url] [url=http://wiki.hudson-ci.org/display/~propecia8hvg]order pharmacy propecia assurance [/url] [url=http://docs2.codecauldron.org/display/~tramadol45g]tramadol make you tired Trisha [/url] [url=http://www.jugindex.org/display/~tramadol8ik]pet dosage for tramadol WATERMARK [/url] [url=http://wiki.directi.com/display/~klonopin5uvf]order Klonopin cheap prerequisites [/url] [url=http://www.amwiki.de/display/~acomplia7ui9]buy cheap acomplia overnight DeCanio [/url] [url=http://www.jugindex.org/display/~viagra8ik]cheapest viagra in Amsterdam ao [/url]

  • http://www.nomiinfotech.com/ Web development lucknow

    Very good tips .
    Thank you.

  • http://www.zunskigraphics.com Lance

    Without a doubt the “standard” way of adding flash is SWFObject… in fact — now it’s SWFObject2 and there are plenty of “extras” you can do with it.

    I recommend checking out http://www.gotoandlearn.com

    Good stuff regardless

    L

  • http://www.pipthepip.com/ phil

    what a terrible tip

  • katsuo11

    You just saved me a headache!

    thanks

  • Pingback: Web Design and Development Tutorials | Serene Destiny

  • http://angrydba.com/ cialis

    Hello!
    cialis , cialis , cialis , viagra , cialis ,

  • http://familyvideos.ru astombstosorb

    Hi, do you think, if you make as you wrote in your comunity, then something will happen? Or, you can not even try? Something like that I’ve seen this blog

  • http://www.whoisbucket.com/view/topwathcez.info Sidney

    I don’t like the sound of all those lists he’s making – it’s like prepossessing too many notes at high school; you sensible of you’ve achieved something when you haven’t.

  • Pingback: Create a Slick Tabbed Content Area using CSS & jQuery « Rabbitinblack Blog

  • Pingback: ทำ Slider Show แบบง่าย ๆ « Rabbitinblack Blog

  • slick

    hi…need help to insert swf file into a header. . thx

  • Fahim

    Thank you sooooooo much!