Solved

Flash and onresize don't play well together

Posted on 2001-08-08
10
153 Views
Last Modified: 2012-08-14
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?
0
Comment
Question by:mblase
  • 4
  • 3
  • 2
  • +1
10 Comments
 

Expert Comment

by:setien
ID: 6365265
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
 

Expert Comment

by:setien
ID: 6365387
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
 
LVL 2

Author Comment

by:mblase
ID: 6366013
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
 

Expert Comment

by:setien
ID: 6366089
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
 
LVL 2

Author Comment

by:mblase
ID: 6367766
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:setien
ID: 6367788
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
 
LVL 2

Author Comment

by:mblase
ID: 6368234
Thanks, but I already said that I've solved the problem myself.
0
 
LVL 12

Expert Comment

by:ahosang
ID: 7956030
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
 
LVL 12

Expert Comment

by:ahosang
ID: 7998915
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
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 8077711
Per recommendation, points refunded and question closed.

Netminder
EE Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now