swfobject, IE7 and flash can get along.

Yesterday I got a panicked email from my client with a bug from their client. This sort of tertiary contact is part and parcel of being freelance.

The email contained a bug in my latest project. The bug was;

This is the exact error in IE7. I’m running Flash 10,0,2,54 Debug.

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.utils::MainImporter()
at subaruLegacy/checkFlashVars()
at projectClass()

I love Flash errors. No, I really do. The fact that I can instantly look at this and know precisely where the problem lies is amazing. checkFlashVars is the function I use nearly instantly at instantiation of the entire project to grab the provided variables from swfobject. ie. project language “en” or “fr”, location of the xml content, locations of external links. I didn’t want to need to update this project after delivery so i externalized quite a bit of it for editing outside of flash. Always a good plan.

So back to the bug. What happened is swfobject isn’t passing the flashVars to flash in time. The likeliest reason is the page isn’t loading completely in time for swfobject to know precisely what it’s sending. I didn’t know this at the time, but I obviously knew something was amiss.

In comes Twitter.
wtf is with fp10 and IE7? they not friends? got an email from the client and they’re freaking out.

You want to be concise? Use Twitter.

Nearly instantly, my good friend Chris Pelsor IM’s me and says “We had the exact same problem, hold on.” After over an hour of him cleaning up my html, asking Stacey Mulcahy to join in on the fun, having her ask “Is your code smart enough to know when it’s failed?” and “What version of swfobject are you using? 2.1? Update, Hugh.” and the both of them testing, Chris found the project where they figured out the solution. I don’t want anyone else googling “IE7 flash player 10 not working” like I did initially. So here is the solution.

Obviously, you’ll need a div called “content” or whatever you are determined to name it.

I had to admit a couple of things to two people in who’s opinion I respect;
1. I know very little about html. I look stuff up, I copy, I paste.
2. I know even less about css. Copy, paste.
3. No, I don’t know why there are three different methods of commenting in the html. Copy, paste.
4. I agree, I should learn. I’ve written it in my agenda.

One thought on “swfobject, IE7 and flash can get along.”

Leave a Reply

Your email address will not be published. Required fields are marked *