FreeMind Flash Viewer Broken With Flash 10?
After some mildly confusing debugging, I finally discovered why my MindMap Viewer was not working with some configurations of Firefox 3, Flash, and Linux or Mac. I first noticed this myself on Linux a couple weeks ago (Ubuntu / FF3 / Flash 10), and assumed this had something to do with my recent upgrade to Firefox version 3. Then today, a viewer commented on a recent post that they were seeing the following error on a Mac:
Since it was working on my Mac (in hindsight running Flash 9), I decided to investigate further.
The viewer fundamentally relies on FreeMind to render the mind maps, and supports the Flash and Java plugins. It turns out that the original version of the FreeMind Flash viewer I downloaded back on Oct. 2007 had issues correctly detecting the version of Flash if version 10 was installed.
Although this wasn’t a direct problem with the flash viewer itself, there was an issue with the copy of flashobject.js. FlashObject, which was the precursor to the new SWFObject, helps abstract some of the difficulty of embedding flash content, and messaging the user to download the current flash version if it’s not currently enabled in their browser. Unfortunately, the version of FlashObject that the FreeMind viewer used was 1.1.1 from 5/17/2005. After careful inspection of the current FreeMind wiki viewed source of a map that was working and noticed that their version of flashobject.js (although listed as 1.1.1) had 2 additional lines added to the getFlashVersion() function:
var aux= y.charAt(y.indexOf(‘.’)-2);
Unfortunately, the method that flashobject used to determine that version had incorrectly parsed the version string (e.g. “Shockwave Flash 10.0 r12) using this logic: flashversion = y.charAt(y.indexOf(‘.’)-1) and misidentifed the version as 0! The 2 additional lines above correct the problem above.
I revisited the Freemind Flash viewer website, and download the latest version to see if this new code was there as well. Although the version was still listed as 1.0b, it appears that the flash version “hack/fix” was put in place on 10/17/08. I’m glad the problem was fixed, and mystery solved, but there a couple developer lessons to be learned here:
1) Document Document Document. Although flashobject.js is now deprecated, the fixed version should have been put in version control. And, the README and version number of freeMindFlashBrowser.zip should have been updated to reflect the change and correct support for Flash 10. Oddly enough, I could find no mention of these changes on the FreeMind wiki or the discussion forum on Sourceforge.
2) Upgrade 3rd party libraries. I’m sure FlashObject was getting the job done, but unforuntately broke when Flash 10 was released. Since it’s an unsupported/deprecated project it required some developer to hack in those 2 lines of code. It’s unclear if it was the original Flash viewer developer, or somebody from FreeMind. It would probably be worthwhile to replace FlashObject with the newer (and supported) version of SWFObject 2. After doing some Googling, it seems developers on other project have experienced a similar problem with FlashObject and are opting to upgrade.