SWFObject, née FlashObject 1.4 released

New version is out! The new version is 1.4, and there are only a few small changes/additions:

Go get it!

Changes:

  1. [updated] SWFObject.write() now returns true or false depending on whether the SWF content was written to the page or not (true if it is, false if it is not)
  2. [changed] The ‘com’ namespace has been removed, now everything lives in the ‘deconcept’ namespace only, instead of ‘com.deconcept’ namespace
  3. [updated] I made a couple of very small changes to get rid of warnings in the mozilla script debugger when the debugger was in strict mode
  4. added ‘the mark of the web’ to the examples pages to (hopefully) prevent the ActiveX bar from appearing at the top of the page when viewing these files locally in IE on Windows.
  5. [changed] And last, but certainly not least: FlashObject is now known as SWFObject because of legal reasons

The namespace change is significant if you are directly accessing any of the internal functions inside SWFObject, like the getPlayerVersion() call. This should be easy enough to modify. I’ve also left in the reference to ‘FlashObject’ so if you want to upgrade, but don’t want to update your HTML pages just yet, you should be able to just drop in the new swfobject.js file, update the references to that script, and your SWF files will still show up.

As for the name change: Yes, it has been a pain in the ass, but not as painful as I thought it would be. So far the renaming of the functions / documentations has only consumed a few hours. Changing the mailing list from FlashObject to SWFObject was a bit trickier, and I’m considering just moving it to Google groups instead of the current mailman setup I’m using now.

As for the overall effect of the renaming, I’ve come to think that it may actually be a good thing for SWFObject once the dust settles. There was a small blog blitz about the subject, which caused a small spike in traffic to the blog, which will probably just end up informing more people about the script. Current users will have a few small changes when they want to upgrade to the newest version, but it’s nothing that will take a huge amount of time. And since I was in Toronto at FITC when it happened, I had the chance to hang out with a few Adobe people and discuss the issue with them. They all agreed that it wasn’t really a good thing, but that there’s no reasoning with that feral beast that is the Adobe Legal Team®™.

I do, however, have concerns for other open source projects out there with the word “Flash” in the name. For them, changing names may not be so easy.

As for an update on the entire “using the word Flash” situation, Adobe (I’m told) is working on a response to everything, so hopefully in the next couple of weeks we’ll get a more comprehensive official statement from them that will clarify any outstanding questions.

Download SWFObject now.

UPDATE: As always, you’ll probably get a faster response to your support questions if you join and mail the SWFObject mailing list instead of mailing me directly.

130 thoughts on “SWFObject, née FlashObject 1.4 released

  1. Mike: Since the fla uses Express Install and is meant for use with Flash Player 8 and higher (you can use it with 7, but it’s much less valuable because fewer people have Flash Player 6).

    If you want to view the code, you can look at the expressinstall.as, or download the free trial of Flash 8 and use that to open the fla and save it as Flash MX.

    Sloan: You should not ever have to edit the swfobject.js file. If you want more people to see your Flash content, you’ll first need to publish it from Flash as a lower version, then update your embed code to require that version.

    The ‘required version’ is set when you create the new SWFObject in your js code.

  2. I guess I wear my Flash ‘rookiness’ on my sleeve, thanks for pointing out my obvious mistakes, Geoff.

  3. Geoff, This looks great! But I am having a problem. Whenever I load my page the movie I am playing is smaller than normal and there is a border around the movie. In other words If I set my x and y to 500 the movie is 250 and the border around it is another 250 (I am guessing at these numbers). The border is the color of the background. Would you know why this is happening?

  4. I don´t want to polemize Geoff´s work (his SWFObject is very usefull for many flash designing people) but:

    HOW WE CAN TALK ABOUT ACCURATE FLASH DETECTION, when you have latest flash player plugin on your machine and only simple stupid thing as OFF JavaScript, results FAILURE IN FLASH PLAYER detection ???

    Geoff, it is not critisizing of your work, I don´t have better solution for this problem too, but we all should consider to find simple and more accurate detection method, not depending on other conditions.

  5. Well, you have to think of Flash in a different way – it doesn’t make sense to show the user a blank area if they don’t have Flash. So if you use SWFObject the right way, you’ll have alternate content instead of a blank area.

    I’ve written about the subject in another post here.

  6. Great script – loving it!

    One question though: how do you have more than one flash file displayed on a page at the same time (i.e. two flash files, one on top of the other)?

    Thanks for this useful script.

  7. Excelent JS!
    I helped me a lot!
    I added to the script a param so I can set the ‘wmode’ param directly when its writing the code. I works both in IE and FF

  8. I’m trying the Express Install technique, which would be great, except that with SWFObject, I can’t find an option to redirect the user to non-Flash content if they decline the plugin upgrade. When I test it (in IE 6, XP SP2) and decline the plugin upgrade, I just get a javascript alert box saying the content requires the upgraded plugin. With the Macromedia FDK, there is an option to make redirects for an upgrade decline and an upgrade error. Is there something similar for the SWFObject? Unfortunately, if there isn’t, that’s a dealbreaker for my clients.

  9. Hi, anybody have issues with displaying flash with Opera using the flash.addParam(“wmode”, “transparent”);
    parameter? Its fine in IE and Firefox, but does not display at all if I add that. I’m only adding that parameter because I have a JAvaScript menu that overlaps some of the flash content and otherwise the menu does not display “ontop” of it.

    Thanks
    Frank

  10. Hello,

    I have a problem that I can’t solve with your script : my flash applet (an mp3 streamer) autostarts correctly from ffox, but fails to do so in ie (I *have to* richt click on the applet, and select “read” for the movie to play)

    I’m pretty sure that you applet is not causing this behaviour, but any hint would be welcome !

    Regards,
    Gael

  11. I am new to the wrold of web design and I am trying to gobble up as much info as possible, with that said I have a couple of questions, just for my own clarifiction…,

    A difference between SWF Object and the Adobe-Macro FDK is the SWF Object ease of use? Additionally the SWF Object is better at detection? Also, the SWF Object takes into consideration the issue with the Active X controll?

    Am I right in thinking this way?

    Thanks

  12. Boots: Look in expressinstall.as, you can customize what happens if the user clicks yes or no.

    stepanski: Some browsers don’t like wmode = opaque, but many of the current modern ones display it properly, it may just be a matter of tweaking your other page elements so they look better.

    Gael: I’ve never seen that behavior, have you tried embedding it with other embed techniques? It might help if you can narrow down the cause of it.

    john: yes, yes (but not by much) and yes.

  13. I’ve just had a Mac User tell me that my site keeps telling him to upgrade but he definately has Flash 8 installed. It otherwise seems to work fine in Windows. I wonder if there is anything obvious I should check.
    I did notice that in windows the Firefox browser window (behind the popup)has to be closed manually for the process to finish. Internet Explorer otherwise does everything automatically. Any things I should be checking for this MAC issue would be lovely please. All the Best.

  14. Macs are usually really good with this stuff – the only issue that could cause it to fail is if they have 8.0.24 installed, and you are requiring 8.0.24 – there was a bug in the first few weeks of that player version that would cause the detection to report that the users really has 8.0.23 instead of 8.0.24, so you should never require 8.0.24, but do 8.0.23 instead.

    Other than that, have them uninstall and reinstall the Flash Player and see if that fixes it.

  15. Thanks Geoff. I’ve added a shortcut link to a different page just incase, for those who definately do have the plugin. All the Best. Still waiting on the Macster to see if anything improves.

  16. Well you can use the bypass link in your alternate content, so if the plugin detection fails for whatever reason, they could click that link and see the Flash stuff.

  17. Hi. This is a great script :) I was wondering though, is there any way to get it to not only detect the flash version, but also make it say that if you’re stupid and using AOL to browse this site, to use the alt info instead of the flash? The flash I made uses the loader component to load a random background image and it works great in all the browsers, but on AOL it doesn’t load the images :( So for the alt info, I just have 1 image that I’d like to use… and that works great for old versions of Flash, but AOL still gets a blank box :( Any ideas?

  18. I think you’re on your own there… sound like you could either a) fix whatever is wrong with your swf file so it works in AOL, or b) sniff the AOL browser and not display the swf for them.

  19. Great job at this. I was moving from flash 8 detection kit to this, when I found something odd that I can’t explain.
    I have a menu in flash that is 950×32 pixels. I just rechecked the fla and it is set to that.
    var so = new SWFObject(“flash/menu.swf”, “menu”, “950″, “32″, “8″, “#000000″);
    If you go to http://www.cameron.k12.wi.us:81 you will see it has a 1px black line on the right side. While I can change the line to almost be invisible, I am wondering why it is there.
    To see the flash file alone, its http://www.cameron.k12.wi.us:81/flash/menu.swf
    when you increase the size and hit 100% view, there is no “spacing” on the right.
    Not the end of the world just wondering what is up with it.
    The div does not have a specified width or bg color, it is blank except for the a:link and a:visited.

  20. You are setting the background color of your swf file to be black (with the #000000) – so your background graphics inside the swf must not stretch all the way to the end of the movie. Try either changing the background color to match the light blue, or extend the background graphics inside the movie so you can’t see the black background.

  21. Hi!
    First BIG THX 4 this fantastic piece of script! But I got one problem:
    I use the fullpage.html and i want to show the height and width. so i made a dynamic textfield displaying Stage.width and Stage.height. This works fine in Firefox and Opera but not in the IE. IE returns only 0 :-(
    Any idea how to fix this ?
    Thx in advance
    Sagi

  22. I just started using SWFObject. How can I display the user’s current flash viewer in the alternate content? Instead of just telling them they need to update flash, I’d like to show them which version they currently have. Is there a function in SWFObject.js I could use for this?

  23. This is a great tool. I have some flash that, in the tag, specifies an XML configFile, like this:
  24. Sorry, in my previous comment, the configFile param is:
    param name=”movie” value=”one_to_one.swf?configFile=dragone.xml”

  25. Geoff,

    Your script works fine on localhost but not on remote server. Anyone else have this problem? See http://www.monkeymug.net/activex/fullpage.html for Geoffs example on my webserver. I am testing with flash player 8.0.24 on I.E. 7 beta but same results on I.E. 6. Can someone check the link and see if it works for you? Also, i did the uninstall and re-install as suggested in the post to Brad but still same problem. What is going wrong here?

  26. Dave: your first example should work – the correct way to add in a variable is by using addVariable(), so it would look like this:

    so.addVariable("configFile", "dragone.xml");

    just make sure you put this before you call so.write();

  27. I am trying to align the swf in the center of the browser window, but it does seem to work. I tried so.addParam(“align”, “center”), but it positions the swf in the same position as a “left ” align. When I experiment with so.addParam(“align”, “right”) it seems to work. Any suggestions on the center alignment.

  28. I have a problem that only shows up in Safari (which sucks since I’m a Mac guy). Here’s the code:

    [see below]

    ds the flash widget which then grabs the MP3 file that’s passed in and plays it. The problem is with the “ap” variable I’m passing — that tells the widget to start playing the MP3 file as soon as it’s loaded. It works as it should in Firefox for Mac and in IE for Windows (only other browsers I checked) but in Safari 2.0.3 (and OS X 10.4.6) the auto-play doesn’t work. The widget gets the instruction, because the state of the widget changes, but I actually get an error message in the Activity Window: Plug-in Cancelled, and it shows the URL to the MP3 file.

    I really want to use SWFObject but I hate to do it if I also have to tell people the auto-play doesn’t work with Safari. Any tips?

    Thanks.

    Jay Jennings

  29. Sheesh, I guess I thought wrapping the code in code tags would magically make it show up. Lemme try again with the code for the preceeding comment:


    <div id="51sm-intro-24.mp3"></div>
    <script type="text/javascript">
    // <![CDATA[
    var so = new SWFObject("smplayers/b_smword21.swf", "sotester", "76", "23", "6.0.65", "#FFFFFF");
    so.addVariable("src", "mp3files/51sm-intro-24.mp3");
    so.addVariable("ap", "1");
    so.write("51sm-intro-24.mp3");
    // ]]>
    </script>

    If this doesn’t work I’ll just slink away…

    Jay Jennings

  30. guys having a problem with my CSS menu not showing up on Firefox MAC 1.0.3 It shows up but when you move your mouse to select a child menu item(over flash header) then menu will dissapear. Live site:

    http://www.sydneyfilmfestival.org

    Am currently using the mode transparent thingo to no avail. Menu works in safari / IE / FF on PC

    Current Code:


    <script type="text/javascript">
    // <![CDATA[

    var so = new SWFObject("/persistent/siteImgs/sffHeader.swf", "swfSFF", "772", "207", "7", "#1A1A1A");
    so.addParam("wmode", "transparent");
    so.write("flashHeader");

    // ]]>
    </script>

  31. Thanks for this Geoff

    Under the FAQ is a link to Flog Flash Blog with a Publishing Template for Flash 8.
    Is that as good a method as doing it manually or would I better off doing it myself ?

  32. Hi there,
    great solution so far. But, today’s MS Updates seem to break it up.
    I had to restart my computer this noon, clicked “Install Updates and …”. And since then all my upgraded Flashsites doesn’t work anymore. (doesn’t work’s the wrong word, but the’re in the state from before SWFObject).
    Anyone else remarking this today?

    rainer

  33. Hi Geoff,

    I found the problem in my earlier post… thanks for your response. All is working well except the 100% height in firefox like Chris Court’s problem. I am including the following lines from your fullscreen example:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </html>

    and the page style block too. Any ideas on how to tell firefox to render full height?

  34. All of you posting support questions here should really try joining the SWFObject mailing list instead. There’s over 200 people on it currently, and plenty of them should be able to answer your questions much faster than I can on here :)

  35. Geoff and whoever…

    I have found a solution to 100% height problem in Firefox and possibly other browsers.
    Turns out if are using asp.net to render variables out to the SWFObject script then you need to also give the form tag a style height of 100%.
    Try doing this if you are having the same problem – maybe you smart guys already figured this out but its not posted here.

    I have tested this in firefox, I.E. 6 and 7 beta and Safari. If someone has a different browser could you please test this link and see if it renders correctly. Thanks,

    http://www.monkeymug.net/guests/guestviewer.ashx?InvitationID=6ECADBBC-4B4D-4C86-87E9-C0B1BD25DB30&AID=8

  36. Hey Geoff & whoever .. in response to my own question, if anyone happens to want to know. I found out AOL wasn’t displaying the images being sucked in with the loader component because AOL changes images files to ART files, because AOL is stupid, so Flash couldn’t find the file it wanted. You have to put each image you want to load into it’s own little swf file, and tell the loader to load the image swf.

    But now I ran into another problem. For some users, who have yet to tell me what version if IE they have, they’re getting the flash movie to display twice when I use this script. Any way around that? I read here (http://activecontent.blogspot.com) that this guy’s rewrite div script will sometimes make IE display the movie twice, so I’m thinking it might be done in a similar way as your script. So, short story long, I’m wondering if you know of a way around that?

  37. Tom: I think the AOL/art file problem has been addressed before, it’s a generic Flash problem, not a SWFObject issue, but I can’t remember what the fix for it was.

    As for the dual movies, SWFObject doesn’t work the same way as other active content fixes. If you use it correctly, you should never see (or hear) two swf files at once.

    How is your alternate content set up?

  38. The alt content is just a big jpg with all of the necessary info… so basically you get an animated flash movie, or a static image of more or less the same thing.

    here’s the page in question .. http://www.gutsywomentravel.com/default-flash.asp

    it works perfectly fine on every different browser / platform I test it on, so I have no idea how that person got it to display twice. Just thought I’d check and see if maybe you knew why it might be doing that. for all I know it could be some ancient version of IE on windows 95 or something. I asked em more about their setup and they never replied.

  39. I found that transparent mode has a problem. Maybe not important.
    In script :
    so.addParam(“wmode”, “transparent”);

    in html:
    <input name=”password” size=”25″ type=”text” />

    If put mouse into the textbox, icon will splash quickly

  40. The express install was failing for me when running on a secure server (SSL). The connection to macromedia failed silently and the upgrade to flash 8 dialog would never come up. I had to change the path in the expressinstall.as file to point to https not http. Might be good to put that out in your FAQ in case it hangs other people up as well.

  41. Looks like Macromedia just posted the update with the Dreamweaver 8.0.2 patch to fix this problem. Way to stay ahead of them, but users won’t be noticing this problem anymore after they update. Cheers, Jared

  42. Thanks for the swfobject workaround. I still have a difficulty with Internet Explorer though. The information bar appears and restricts the content loading. The swfobject side of things seems to be irrelevant, the inclusion of the script tag being enough to cause the bar to appear. Any ideas?

  43. I’m finding that it is allowing IE6 with Windows XP and Flash 6 to see Flash content makred as version 7 or above.

    Any ideas?

  44. Nick: You should make sure that you ran the Adobe Flash Player uninstaller when you switched plugins. If you just install an older version on top of your current version, then the install will be corrupt and the Javascript detection will break.