There was a new bug intruduced in the 1.4.3 release of SWFObject, so if you are using 1.4.3, you should upgrade to 1.4.4 immidiately.
The issue is that onbeforeunload is being triggered even when a user clicks a link that contains a javascript link, which causes the cleanup routine to trigger, which makes all your swfs on the page dissapear in IE.
This has now been fixed, and 1.4.4 includes all of the ‘fixes’ that are needed to date, including the streaming media fix, and the Flash Player 9 ‘out of memory’ errors.
* One new issue that can arise with the addition of the cleanup routines, is if you are including the swfobject.js script in your pages more than once, you will cause more ‘out of memory’ errors. If this happens, make sure you only insert the swfobject.js file in your page only one time.
The switch to ExternalInterface is working with the default 1.4.4 code. The reason I suspected your code was the description is exactly what is happening in IE with the swfs disappearing.
I thought I commented out most of your cleanUpSWFs() code but I didn’t spend too much time with it. If you are interested I can gather up some examples next week once I get this site launched.
Does anyone know of a way to test what the site looks like for users who have older versions of flash? It seems once I have the latest flash installed, its not very easy to uninstall it.
Can I download some old browser that isnt bundled with it? Or does someone know how to uninstall the plugin?
thanks,
-parker
I usually just disable Javascript in my browser to test it.
I did that, and the default does show, but I want to make sure it actually prompts the right users to install the latest Flash. Oh, maybe I should mention I’m trying to test the ExpressInstall functionality.
For example, I have Flash 8 installed; I adjusted the function to look for version 9; I would expect that I should be prompted to upgrade; but I’m not, the page just loads.
So its really two questions now,
1-how do I test it with older versions of flash when my computer has the latest? (maybe I can set the function to look for a higher, possibly non-existent, version, like “14″ or in my case “9″?)
2-does it sound like something is wrong if I set the function to look for “9″ when I have 8, and it loads the site without an upgrade prompt?
To test Express Install, you should get an older version of the Flash Player (search for ‘archived flash players’) and use the official uninstaller before you install an old version.
Using a version like 14 won’t work, because the update won’t happen if you already have the latest version.
If you have Flash Player 8 installed, and require Flash Player 9, then the update should be triggered, so if you are seeing the movie play normally, you either have Flash Player 9 installed, or the Express Install code in your fla isn’t set up right.
Thanks for the swfObject, Geoff- I use it all the time. But I think I’ve run into a bug. It works great for full browser Flash, but when trying to use it in a liquid two column layout where the overwritten div is expandable, it creates a useless vertical scrollbar. Observe:
EXHIBIT A
, the grey area is the HTML div, and the yellow is the div that I want to replace with the swf using swfObject. You can see that the styles themselves don’t create a scrollbar.http://spacefoundry.com/clientview/opa/noswfobj100/
This version has no swf- the red area is the
EXHIBIT B
http://spacefoundry.com/clientview/opa/swfobj100/
Now observe the same markup with the swfObject added- a useless vertical scrollbar appears.
EXHIBIT C
http://spacefoundry.com/clientview/opa/swfobj99/
In an attempt to debug this, I changed the height of the yellow swfObject div from 100% to 99%– this removes the scrollbar in Firefox and Safari, but not in IE, and it has the unfortunate side effect of creating a space at the bottom of the page. I want the swf to extend to the full height of the browser window.
Well that’s interesting… have you tried it without SWFObject to see if it’s something with the Javascript/innerHTML method?
Maybe the object or embed tags are adding a little bit of padding/margin somewhere? (maybe try setting a height/width in the css for the object or embed tags?
Thanks for the swfObject, Geoff – I just ran into the externalinterface and swfObject seems to be working.
I found an issue, however, as I am building things in .net. ASP.net puts everything inside a form tag, and i’ve found I get javascript errors when I put my flash in a form tag. The form has an ID of ‘form1′. I’m looking at the .js source, but I’m having no luck. Any ideas?
Hi. Are there any easy instructions for installing this?
http://blog.deconcept.com/code/intkit/
Matt
Hello Geoff,
I just stumbled on your site while desperately trying to find a fix that WORKS for the Flash problem in IE. I’ve tried your fix and it stop the “Click to Activate” issue, but I’m still getting very long download times with the xxx item remaining to load message. I suspect it’s not SWFObject, but something else. I’m having this problem on nearly every site that I use Flash. Here is a stripped down sample with just the flash and the script: http://www.avirtuouswomantour.com/swf.php
Hope you can help. Thanks for the solution!
Hey Geoff,
First of all, big thanks for SWFObject… it’s been a huge help on my sites.
But, yes, I’m writing about a bug(?) I’ve encountered. When I try to pass text to my .swf using SWFObject, it doesn’t work. Any other flashvar I pass seems to work ok, and the .swf works ok when I just embed it as an object… but when I assign the value to the flashvar param (or use addVariable) it just doesn’t show up… even though it shows up correctly in the
Code looks something like this:
Am I missing something? Any insight?
Thanks,
-js
So I just started using flash object and I am really liking it. However, I just had my wife try and view 1 of my new pages from her work and she is getting the “This text is replaced by the Flash movie.” message instead of the Flash movie. Now I know she has flash player installed because she can view my older sites that don’t use SWFObject just fine. Is she missing a java component or is there some security setting on her browser that may be causing problems? Also, what if she has an older flash player installed and the movie being loaded by SWFObject requires a newer version?
Once again she can see: http://www.beecreekestates.com/siteplan.htm just fine
but has problems with: http://www.robroywest.com/
Once again great product!
Thanks, E
Does swobject 1.4.4 support ExternalInterface.addCallback? If it does, what do I need to do to make it function?
I can embed a .swf on a page and implement the Flash example (see ExternalInterface help) and it all works. But when I change to embeding the .swf via swobject, the Flash to javascript works but the javascript to flash (passing parameters) doesn’t.
Thanks.
A follow-up, it all works fine in Firefox but still doesn’t work in IE.
Hi Geoff. Thanks so much for SWFObject. Im having some troubles with using flash in a template which is replicated numerous times (and hence having duplicate divs with duplicate id’s). Is there some way around so I can get the original old “so.write();” to work? As it would solve my problem instantly!
Hi, recently I’ve started using SWFobject and I really like how it both solves the IE activation issue and results in valid and nicely degrading pages. However, the pages I’ve made using SWFobject, crash IE7. Not on initial load, but after a few reloads IE7 crashes every time. Firefox and IE6 behave perfectly.
See this in action (this is a new design I’m working on, so this is a work in progress)
The HTML and CSS validate without flaw. I’ve tried this page without flash and with the classic object/embed method and this works without any crashes.
I don’t have this problem when I test your example pages. Any idea what’s going on here? Is there a problem with my code? Or is this a bug in SWFobject?
(BTW, I’ve only installed IE7 on a virtual machine using VMWare, but that shouldn’t matter, should it?)
I forgot to mention the most likely cause of the IE7 crashes, a bug in IE7. Also, in this example I’ve grouped the SWFobject snippets at the bottom of the HTML, instead of just after the div’s. When I do put them there, the problem persists. Furthermore, I realize flash is really not necessary in this design, so if this problem can’t be solved I’ll just ditch the flash for this site. However, I have the same problem on a site where the client really doesn’t want to lose the flash.
Hello.
I’m trying to use SwfObject on my site. I’ve spotted the same problem as Michael (comment from August 9). I’m using polish version of operating system and IE. Everything is OK under Firefox 2.0 but under IE script does not embed swf file. It does not prompt for installation plugin and shows “no file” icon. Have you come up with solution for Michael? Mabe I could use similar one.
[NEW] new addVariables(flashVars) method to add more than one FlashVars in one call.
Sample usage, replace so.addVariable(…) in sample files:
so.addVariables(“file=sample.xml&show=true&repeat=true”);
addVariables: function(nameValueQueryString){
var pairs = nameValueQueryString.split('&');
for (var i=0; i < pairs.length; i++)
{
var p = pairs[i];
var pos = p.indexOf("=");
var name = p.substring(0, pos);
var value = p.substring(pos+1);
this.variables[name] = value;
}
},
Soflion,
You can already do that actually… just use so.addParam(“flashvars”, “foo=bar&foo2=bar2″);
Andrew, Yes, it supports ExternalInteface, you would use it no differently than a normal swf you embed. The only difference is SWFObject allows the object + embed tag to have the same Id, so you only need to use 1 line of code to get the reference to your swf: var theswf = document.getElementById(“myswfid”);
Michiel,
The IE crash may be caused if you are using Flash Player 6 – the next version of SWFObject will fix this. If you want to try it out ahead of time, you can grab it from here:
http://svn.deconcept.com/swfobject/
The only major change is how the Express Install stuff works, so check out the example page to see the updates.
Geoff,
Thank you for that, it now works perfectly. You’re doing a great job there. Keep up the good work.
I’m confused. On IE7, I go to install version 9 of the flash player but it says version 7 successfully installed upon completion. Anyone else have this issue with IE7 and flash?
It sounds like your install is corrupt. You need to run the uninstaller first, then install version 9.
Hi,
I use for a short time swfOBject and I have a probleme. With swfObject on IE the fscommand on flash don’t call my myAnime_DoFSCommand function but on FF work great. Anyone have the same problem ?
An example of caode that work on FF and not on IE :
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />var so = new SWFObject("trackbar.swf", "trackbar", "500", "400", "9", "#336699");
so.addParam("swLiveConnect", "true"); so.addParam("allowScriptAccess", "always");
so.write("flashcontent");
Sorry, my entire code seems not visible in my last post. I repeat the code here, I hope it was visible :
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />var so = new SWFObject("trackbar.swf", "trackbar", "500", "400", "9", "#336699");
so.addParam("swLiveConnect", "true"); so.addParam("allowScriptAccess", "always");
so.write("flashcontent");
Thanks for all your work on this script. I use it on multiple Web sites. Anyway – I’ve found a quirk in IE7 that is easily reproduced. If the flash embed snippets are in a table, then IE7 flakes out and the movie will only play *sometimes*. You can break the sample code in “fullpage.html” from the ZIP package by:
- just after the
tag, insert:tag, insert: the flash will not load most of the time. I’m going to uninstall the flash player one more time and try again to be double-sure about this, though.
Sorry, my sample html didn’t make it into my post. So here are the steps again:
- just after the opening body tag, insert an opening table, tr, and td tag
- just before the closing body tag, insert a closing td, tr, and table tag
Ok, so same thing after an uninstall/reinstall cycle with Flash for IE7.
So, I wanted to take my quicktime movies and convert to flash video. I did that through the automated process in flash. It gives me an swf that calls the (skinofplayer).swf and video.flv. When using the SWFObject solution to embed and show it makes the video file smaller and completely hides the player skin.
http://onemanshortproductions.com/projects.php for an example. Know what’s up?
Shaun,
It looks like you need to change the size of the swf in the SWFObject parameters. You still have it set to my test movie size.
var so = new SWFObject("/trailers/votejoe.swf", "votejoe", "320", "240", "8", "#FF6600");Change to my correct video size… didn’t fix. I have a feeling it has to do with the swf calling another swf into it. I don’t know much about flash as I just used the automated process. Also whatever size i increase the thing to, it gets bigger and applies huge margins around the flash video and just shows the background color.
should we correspond in email so as to not spam your blog?
Right so I resized the actual canvas size of the flaw and exported the swf, so now it has no blank space. he video part loads when using swf, but it does NOT insert the media player bar under it, where you see the orange background. That seems to be the problem.
I have seen a couple of comments about IE seeming to pad the embedded flash object so I thought I’d post my experience and subsequent fix. I’m using swfObject 1.4.4 and IE6 and despite setting the flash object width and height to be 100%, the containing
Any ideas Geoff?
Geoff,
I can also comment on the issues of IE7 and SWFObject. It causes IE7 to crash if the user leaves the page or refreshes it. I wrote a custom control that spits out the raw HTML for IE7, but if the SWFObject script is still included in the page, it will cause the crash.
I removed the SWFObject script on IE7 and viola, it works fine. So, I suppose it has something to do with adding an “onunload” event handler to the page causing memory read errors (null pointers in IE, ect) because it is trying to trigger something IE has disposed of. IE7 should handle this gracefully, but well it is IE.
I wonder if the addVariable is possible to get from anywhere in actionscript 3.0 (using either 1.4.4 or the early 1.5)
I think its better to round up the coordinates where the upgradeMsg is placed, if the express install option is on, that way we eliminate possible anti-aliasing problems with non integer coordinates.
var upgradeMsg = _root.attachMovie(“upgradeMsg_src”, “upgradeMsg”, 1);
upgradeMsg._x = math.round (Stage.width / 2);
upgradeMsg._y = math.round (Stage.height / 2);
Geoff, I tried, even ufo, to see if it would work… it doesn’t. So it’s a problem on my end I’m thinking, was wondering if we could correspond a little via email to fix this?
nevermind, all fixed.
Though, IE7 won’t play the trailers unless you click the link ?detectflash=false
Can you add support for border? I don’t really know java… This seems to work… I changed a line in the code as follows:
swfNode = ‘
I also thought it would be best to change getAttribute as well:
getAttribute: function(name){
if(this.attributes[name]) {
return this.attributes[name];
} else {
return 0;
}
},
Let’s try again… [NB: Can someone delete prior post?] Can you add support for border? I don’t really know java… This seems to work… I changed a line in the code as follows:
swfNode = '
I also thought it would be best to change getAttribute as well:
function(name){
if(this.attributes[name]) {
return this.attributes[name];
} else {
return 0;
}
},
Hald, try setting the border with CSS instead… it’s much cleaner.
I’ve got problem with unloading function deconcept.SWFObjectUtil.cleanupSWFs
It removes swfs starting from the first, so the remaining in this moment move up. It lasts just miliseconds, but my client coudn’t accept that. So I simply modified the order:
for(var i=_2d.length;i>0;i–)
and now it works fine, I hope.
for(var i=_2d.length;i>0;i–-)
of course…
once again:
you can see unaccepted version at
http://www.gmedia.pl/stradom/not/
acd working at http://www.gmedia.pl/stradom/
Hi! I’m new to SWFObject and I love it!
I need some help on javascript. I made a function that uses the
so.write("flashcontent")to replace the div with multiple SWFs. I have the javascript like this:function loadFlash(e) {if (e == '1') {
var so = new SWFObject("flash1.swf", "flash1", "512", "384", "8", "#FFFFFF");
} else if (e == '2') {
var so = new SWFObject("flash2.swf", "flash2", "512", "384", "8", "#FFFFFF");
} else if (e == '3') {
var so = new SWFObject("flash3.swf", "flash3", "512", "384", "8", "#FFFFFF");
}
so.write("flashcontent");
}
And the markup:
Some text
Flash 1
Flash 2
Flash 3
It works but the problem is that the flash doesn’t show up until it is loaded completely.
Uhh… markup:
<div id="flashcontent">Some text</div><div>
<a href="#flash1" onclick="loadFlash('1')">Flash 1</a>
<a href="#flash2" onclick="loadFlash('2')">Flash 2</a>
<a href="#flash3" onclick="loadFlash('3')">Flash 3</a>
</div>
Hope this shows up correctly now.
I have found all my answers right here. Thank you for taking your time to help. I have your page bookmarked!