deanagit / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

streach to percentage in IE #455

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. dynamic embed to stretch to a percentage: swfobject.embedSWF("swf",
"div", "100%", "100%");
2. use javascript to stretch the div itself, sot that it maintains its
aspect ratio when the user resizes the window:
[code]
function doResize()
{
    var uniWidth = 0, uniHeight = 0;
    if( typeof( window.innerWidth ) == 'number' )
    {
        //Non-IE
        uniWidth = window.innerWidth;
        uniHeight = window.innerHeight;
    }
    else if( document.documentElement && (
document.documentElement.clientWidth ||
document.documentElement.clientHeight ) )
    {
        //IE 6+ in 'standards compliant mode'
        uniWidth = document.documentElement.clientWidth;
        uniHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth ||
document.body.clientHeight ) )
    {
        //IE 4 compatible
        uniWidth = document.body.clientWidth;
        uniHeight = document.body.clientHeight;
    }
    menuWidth = Math.floor(uniHeight*530/1446);
    bannerWidth = Math.floor(uniWidth - menuWidth);
    bannerHeight = Math.floor(bannerWidth*240/1135);
    contentHeight = Math.floor(uniHeight - bannerHeight);
    document.getElementById('menu').style.width = menuWidth + 'px';
    document.getElementById('menu').style.height = uniHeight + 'px';
    document.getElementById('banner').style.width = bannerWidth + 'px';
    document.getElementById('banner').style.height = bannerHeight + 'px';
    document.getElementById('content').style.width = bannerWidth + 'px';
    document.getElementById('content').style.height = contentHeight + 'px';
}
[/code]

What is the expected output? What do you see instead?

supposed to stretch the flash objects to maintain their aspect ratios. in
all other browsers it looks fine, but in IE, running doResize on
window.onload does nothing, and running it on window.onResize appears to
use old clientWidth and clientHeight variables. for example: when clicking
and dragging the bottom right corner of a window, the flash doesn't seem to
be able to 'catch up'. and when maximizing or restoring, the size of the
flash is what it should have been before pressing the button, in other
words it is small when pressing maximize and huge when pressing restore.

It should be noted that this does not happen when using static publishing
or not using swfobject at all. however, this is an unacceptable solution
for myself because the flash itself looks buggy in IE and safari unless i
use dynamic publishing.

i've also tried to make a quick fix for this by forcibly resizing the
window with window.resizeBy and window.resizeTo, but this does not work in
IE when there is more than one tab open

see it here, and go up a directory to see dimentionator.js and overload.css
and other files i've used:
http://patiscool.000space.com/yankeev2.1/bannerbadinie.htm

What version of the product are you using? On what operating system?
swfobject v2.2
windows 7 64
IE8 32 bit

Please provide any additional information below.

i hate IE

Original issue reported on code.google.com by chopfica...@gmail.com on 6 Apr 2010 at 8:27

GoogleCodeExporter commented 9 years ago
this is the original poster again. help me understand and i might be able to do
something. ive been following the code of sefobject.js around, and in dynamic
embedding, the 100% i put in for width and height just end up in the string 
"att" and
if the browser is IE, the embed looks like this 

el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + 
att +
'>' + par + '</object>';

so the flash, unless there was an error caught by swfobject, should look the 
same as
it would using static embedding, or if i typed in the html myself.

but here it is plain as day, when i wasn't using dynamic embedding swfobject, 
in IE,
the flash was buggy, you could see part of the swf that was off screen to the 
right,
and certain mcs and elements were improperly sized and positioned, and hanging 
on top
of each other:
http://img40.imageshack.us/img40/1096/58974377.png

heres what the same part is supposed to look, and how it looks when i use 
firefox or
dynamic embedding in IE
http://img682.imageshack.us/img682/5566/firefoxa.png

what did swfobject do to fix it?

Original comment by chopfica...@gmail.com on 6 Apr 2010 at 3:26

GoogleCodeExporter commented 9 years ago
i may have come up for a fix for the window.onload problem. i believe the 
embedding
is occurring before the resizing in IE. can i use swfobject in conjunction with 
a timer?

Original comment by Computer...@gmail.com on 23 Apr 2010 at 1:01

GoogleCodeExporter commented 9 years ago
no that didnt work either

Original comment by Computer...@gmail.com on 23 Apr 2010 at 1:29

GoogleCodeExporter commented 9 years ago
if found a half solution that i am satisfied enoguh with. what you have to do is
trick IE into resizing itself by one pixel about a tenth of a second after the 
window
loads, or the user resizes the window. u can usually use resizeBy(-1,-1), but 
that
doesnt work for unMaximizing. for that, you have to use a resizeTo(), and for
parameters you have to scan the users screen resolution and use a number
significantly less than that. then you have to use another resizeBy(-1,-1). 
this does
not work when the user has more than one tab open, but Fuck IE, there probably 
is no
complete solution.

Original comment by Computer...@gmail.com on 5 May 2010 at 8:05

GoogleCodeExporter commented 9 years ago
This does not appear to be a SWFObject issue. Closing thread. If you'd like to 
discuss this issue further, please post to the SWFObject Google Group.

Original comment by platelu...@gmail.com on 7 Nov 2010 at 9:36