Natalia
Natalia

Reputation: 23

What is the best way to embed swf into html page

I am trying to embed .swf file into html page. Width and Height of swf is 1024*768. I specify 'width' and 'height' as 100%.

<div style="width:100%;height:100%;">
<object style="width:100%;height:100%;">
    <embed src="frontend/flash.swf" width="100%" height="100%" >
</object>
</div>

It embeds swf with 1350px*150px for some reason, not 100% of the height of the file.

If I specify dimensions in pixels for tag embed, it will work.

But I am very curious, why it does not work with %. Thank, any help will be appreciated.

Upvotes: 1

Views: 837

Answers (2)

Christian
Christian

Reputation: 26

You can try swfobject: https://github.com/swfobject/swfobject. It`s very simple to add Flash and Flashvars.

Here with 100%: http://learnswfobject.com/advanced-topics/100-width-and-height-in-browser/

swfobject.embedSWF("test.swf", "flashContent", "100%", "100%", "9.0.0", false, flashvars, params, attributes);

Upvotes: 1

scrappedcola
scrappedcola

Reputation: 10572

You should lookup the tag in the html docs on the Mozilla Developer Network. It specifies that the embed tag has attribute height that is the displayed height in CSS pixels. Since 100% is not a valid pixel value it will not recognize that value.

Upvotes: 0

Related Questions