Solved

Flash and onresize don't play well together

Posted on 2001-08-08
10
151 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Expert Comment

by:setien
Comment Utility
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
Comment Utility
Thanks, but I already said that I've solved the problem myself.
0
 
LVL 12

Expert Comment

by:ahosang
Comment Utility
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
Comment Utility
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
Comment Utility
Per recommendation, points refunded and question closed.

Netminder
EE Admin
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

762 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

9 Experts available now in Live!

Get 1:1 Help Now