Ticex
Ticex

Reputation: 3054

Best way to embed flash in html

There are too many method for embedding flash in html, which way is the best? Requirements are:

I have been reading about SWFobject, has anyone used it/tested?

Upvotes: 8

Views: 8680

Answers (4)

meddlingwithfire
meddlingwithfire

Reputation: 1437

I use SWFObject myself, in combination with the <embed> and <object> tags. The reason I include the HTML embeds, is that SWFObject and flashembed rely on Javascript to update the DOM. Not every user who has Flash installed also has Javascript enabled.

Upvotes: 0

martinlund
martinlund

Reputation: 206

In a project I work on we use SWFobject which works like a charm, it allows you to check for a specific version and also display alternative content if flash is not supported.

var fn = function() {
    if(swfobject.hasFlashPlayerVersion("9.0.115"))
    {
        var att = { data:"flash.swf", width:"y", height:"x" };
        var par = { menu: "false", flashvars: "" };
        signUp = swfobject.createSWF(att, par);
    }
}
swfobject.addDomLoadEvent(fn);

Upvotes: 15

Henrik Ripa
Henrik Ripa

Reputation: 603

I would highly recommend using flashembed. It has support for everything you need and more, without being that complicated to use. It was originally developed for embedding flowplayer, which I can also recommend, but it works for any flash file.

An example of how I use it:

flashembed("frontPageFlash",
    {
        src: "img/flash/FrontPage.swf",
        width: "480",
        height: "600",
        bgcolor: "#ebebeb",
        version: [9,0],
        expressInstall:'scripts/expressinstall.swf'
    },{
        head1: "<%= frontPageFlashHead1 %>",
        head2: "<%= frontPageFlashHead2 %>",
        pitch1: "<%= frontPageFlashPitch1 %>",
        pitch2: "<%= frontPageFlashPitch2 %>"
    }
);

And where it is embedded I simply put:

<div id="frontPageFlash"></div>

Upvotes: 4

Greg Beech
Greg Beech

Reputation: 136587

Yeah, we use that for flash detection on our site and it works extremely well, avoiding the problem that you normally have to click to activate flash controls in IE. We've tested it in many browsers (different versions of IE, Firefox, Opera, Safari, Chrome) on multiple operating systems (Windows XP, Windows Vista, Windows Server 2003, Windows Server 2008, Mac OSX, Linux) and once you've got it set up correctly it works perfectly on all.

Upvotes: 2

Related Questions