Flash and onresize don't play well together

I've got a Web page I'm building with a Flash "applet" and a little dynamic HTML both. IE, not surprisingly, takes these together just fine. But Netscape 4 (4.78, to be exact) doesn't like them together.

Whenever I put the Flash applet in the page, resizing the browser window fails to fire the window.onresize event (I've used an alert() to confirm this). If I take the applet out, the onresize event fires correctly and the DHTML layout is recalculated.

Has anyone else encountered this, and perhaps know of any workarounds?
LVL 2
mblaseAsked:
Who is Participating?
 
NetminderConnect With a Mentor Commented:
Per recommendation, points refunded and question closed.

Netminder
EE Admin
0
 
setienCommented:
I haven't encountered but, it doesn't surprise me. Netscape 4 is so full of little quirks and bugs like that.

If you are in desperate need, you use setInterval() and a function that checks the windows dimensions every 5 milliseconds or so to simulate the behaviour.

If you think that's an ok solution, I can do the code for you.
0
 
setienCommented:
I tested this in netscape 4.7 and IE 5.5, and it worked like a charm.
If you want it to react to resize faster, then change the value 1000 to something less in the line
setInterval(testResized, 1000);

Hope that works for you :)

---


<html>
<head>

<SCRIPT language="JavaScript">

window.onresize = function() {
     alert("I resized");
     }
     
if(navigator.appName.indexOf("Microsoft") == -1) {
     testResized.innerWidth = window.innerWidth;
     testResized.innerHeight = window.innerHeight;
     setInterval(testResized, 1000);
}

function testResized() {
if(window.innerWidth != testResized.innerWidth || window.innerHeight != testResized.innerHeight) {
     testResized.innerWidth = window.innerWidth;
     testResized.innerHeight = window.innerHeight;
     window.onresize();
     }
}

</SCRIPT>

</head>
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="50" height="50">
  <param name="movie" value="test.swf">
  <param name=quality value=high>
  <embed src="test.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="50" height="50">
  </embed>
</object>
</body>

</html>
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
mblaseAuthor Commented:
I'm afraid that didn't work at all. I finally did hit upon the one solution that did make a difference, however: block the page from being cached. I used     &lt;meta http-equiv="Expires" content=""&gt; to do the trick.


When that happens, any of the myriad "netscape resize bug" fixes out there will load the new page from the internet rather than the browser cache, which was causing my problems.
0
 
setienCommented:
What do you mean it didn't work at all? Did it return errors?
It did excactly what you asked for : It worked around the fact that netscape doesn't fire the onresize event.

If you want an answer to something other than that, I believe you should ask it in a different way. What you initially asked for had nothing to do with page reloading.

I believe I provided a valid solution to your question, and thus should be rewarded with the points.

Regards,
Brian
0
 
mblaseAuthor Commented:
I mean that it didn't work at all; it didn't fix the resize problem on my machine. The DHTML still didn't recalculate, and I had to try a different solution.

I'm sorry you feel slighted, but that's exactly what happened.
0
 
setienCommented:
Ah - it's the event itself you are missing, not the onresize function.

You can reload the page on resize, if that's a viable option, and that will work.

I haven't tested the code below, but it should solve your problem.

---

<html>
<head>

<SCRIPT language="JavaScript">

window.onresize = function() {
    window.document.location.reload();
    }
   
if(navigator.appName.indexOf("Microsoft") == -1) {
    testResized.innerWidth = window.innerWidth;
    testResized.innerHeight = window.innerHeight;
    setInterval(testResized, 1000);
}

function testResized() {
if(window.innerWidth != testResized.innerWidth || window.innerHeight != testResized.innerHeight) {
    testResized.innerWidth = window.innerWidth;
    testResized.innerHeight = window.innerHeight;
    window.onresize();
    }
}

</SCRIPT>

</head>
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="50" height="50">
 <param name="movie" value="test.swf">
 <param name=quality value=high>
 <embed src="test.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="50"
height="50">
 </embed>
</object>
</body>

</html>
0
 
mblaseAuthor Commented:
Thanks, but I already said that I've solved the problem myself.
0
 
ahosangFinance Systems DeveloperCommented:
This question has been abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.
 
In the absence of responses, I may recommend DELETE unless it is clear to me that it has value as a PAQ. Silence = you don't care
ahosang
EE cleanup volunteer
0
 
ahosangFinance Systems DeveloperCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ahosang
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.