1

I am a newbie in webdesign and I´ve been wondering which is the modern way to embed swf objects.

I've been using the following html code:

<object id="flash1" data="presentacion/prototipe.swf" height="300" type="application/x-shockwave-flash" width="500">
<param name="movie" value="presentacion/prototipe.swf" />
</object>

However, I've noticed that some designers use a javascript to embed swf files. Like this one

<script type="text/javascript">
var flashvars = {
};

var params = {
    menu: "false",
    scale: "noScale",
    allowFullscreen: "true",
    allowScriptAccess: "always",
    allowNetworking: "all",
    bgcolor: "#ffffff",
    base: "swf/"
};
var attributes = {
    id:"flashMovie"
};
swfobject.embedSWF("swf/flash_movie.swf", "flashMovie", "550", "400", "9.0.0", "swf/expressinstall.swf", flashvars, params, attributes);
</script>

It seems that both ways produce the same results but: what are the shorfalls of these methods? which method is the newest ? Are there any compatibility issues regarding the web-browsers?

Thanks in advance.

3 Answers 3

1

swfobject (javascript) handles the compatibility among browsers and prevents your page from being invalid (which is common with certain settings).

Shortfalls for Javascript would include the fact that you have to load another request for the Javascript file, you rely on using Javascript and you have to wait for that to load client side. All of which I think are insignificant -- I believe it is the best method.

The XHTML method has the opposite pros/cons, does not require extra javascript, it can be valid per W3 standards (but I believe there are some limitations) and you have to worry about browser compatibility.

Sign up to request clarification or add additional context in comments.

Comments

1

You want to use SWFObject because some browers don't support that HTML code that you provided.

Use SWFObject because it will determine what will work so that you don't have to. That way you don't have to know the cross-browser pitfalls. That is why it exists.

1 Comment

Thanks for your warning, I had no clue that the code would not run in some browsers.
1

Another reason is that swfobject() works around a patent-induced limitation in Internet Explorer - Microsoft got sued by a troll for embedding dynamic content in a web page. To bypass the patent, MS added a "click to activate" function on all embedded content (flash, java,, etc...). swfobject() implements a workaround for the workaround, to auto-activate this content without requiring a click.

Just goes to show how moronic software patents are...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.