woodsytime
02 May 2010, 07:10 AM
Hi there,
I'm using a piece of JS to obtain the browser width and height. I then apply these dimensions to a Flash object which resizes the background of the flash object appropriately.
However, I'm not sure I'm getting the correct dimensions as the background of the flash object doesn't seem to be resizing correctly to the browser window. Here's the website (http://www.delightfulweb.com). What should happen is that the red border is evenly displayed around the edges of the browser window...however, only the top and left hand side borders are always visible? This makes me think that the dimensions I'm getting through the JS function aren't correct.
Here's a snippet of code I'm using to obtain the dimensions...please see the website for full source code:
// send X dimension of browser to Flash
function sendX(myWidth)
{
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
return (myWidth);
}
I'm using a piece of JS to obtain the browser width and height. I then apply these dimensions to a Flash object which resizes the background of the flash object appropriately.
However, I'm not sure I'm getting the correct dimensions as the background of the flash object doesn't seem to be resizing correctly to the browser window. Here's the website (http://www.delightfulweb.com). What should happen is that the red border is evenly displayed around the edges of the browser window...however, only the top and left hand side borders are always visible? This makes me think that the dimensions I'm getting through the JS function aren't correct.
Here's a snippet of code I'm using to obtain the dimensions...please see the website for full source code:
// send X dimension of browser to Flash
function sendX(myWidth)
{
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
return (myWidth);
}