Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

100% flash movie size with javascript

Status
Not open for further replies.

ice78991

Programmer
Nov 20, 2006
216
I am using a DOM Script to load a flash movie and I want to set the movie size to fit the screen 100%.

I have used screen.availHeight to get the screen dimensions but have found that I needed to tweek the figure ( -175 ) to get a better fit.

Could someone explain why this is so and is this the best way to get a close to 100% fit. It seems to act differently in Firefox and IE but results are fairly good. I am using the script to load the movie to avoid IE's click to activate this control warning.

<center><p id="site"><a href=" Upgrade to Flash 8</a> to use this sitedemo.</p></center>

<script type="text/javascript">

var scrWidth = (screen.availWidth - 50).toString();
var scrHeight = (screen.availHeight - 175).toString();

var FO = { movie:"movie.swf",width:scrWidth,height:scrHeight,majorversion:"8",build:"0",bgcolor:"#000000"};
UFO.create(FO,"site");
</script>
 
screen.availWidth/Height is the size of the screen (minus OS elements such as task bar under Windows), not the browser window. To measure the browser window size use window.innerWidth/Height for standard browsers and document.body.offsetWidth/Height for non-standard IE.

But why not just use 100% as Flash size? Use SWFObject: <
Kenneth Kawamoto
 
Thanks. Will swfObject bypass the 'Click to activate this control' message on all relevant browser versions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top