Monday, January 9, 2012

Javascript error in Flex: Why my html won't load my swf...oy!

Boy, I hate Javascript...actually I don't hate it, but I hate the errors it can throw.  Anyways, in this issue I explain why a spurious error actually was correct.  I haven't done much Flex 3 in a while, but a current client project asked me to stay within these bounds.  I checked out the code from CVS (ugh) and got everything up.  But when I tried to run the project, I never launched the swf in the html.  Finally I found the error.

Using FireBug, I found that the DetectFlashVer() wasn't firing.  Huh?

I checked the files, made sure I hadn't changed any configuation, double checked with the team that I all the code.  Everything was there, as they had it.

Only upon further investigation did I realize that I was missing the AC_OET.js and /history from my template.  This seemed strange in the beginning, but the client insisted everything was running fine for them.  I had to assume it was my configuration, trying to run Flex 3.5 from Flashbuilder 4.6, I must've been doing something wrong.

My only guess is that because AC_OET.js didn't exist a long time ago (I actually don't know when it was introduced to the SDK), when I tried to build the package, because it wasn't in the html-template folder, it wasn't going to just show up, and because the html template was probably based on the newer SDK, it was looking for the javascript, and because it couldn't find that, never loaded...

Case solved.

Old html:

New html:

var hasProductInstall = DetectFlashVer(6, 0, 65);

This made a big difference.  Hope this helps you.

No comments:

Post a Comment