This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

Saturday, December 31, 2005

Serious bug in Flash 8 ExternalInterface

I recently found a major bug in ExternalInterface in Flash 8. If the value you pass from JavaScript contains a newline, Flash corrupts the value. For example, if you had the following value:

helloworld1
helloworld2
helloworld3

And passed this from JavaScript to Flash (perhaps you got it from the user in an HTML textarea, and are passing it over to Flash), Flash will corrupt the value and turn it into a random number, which looks like some kind of internal memory pointer. I've found this on all browsers on all platforms I have tested (Mac and Windows, on IE, Firefox, and Safar).

This bug is preventing me from using ExternalInterface for now, except as a workaround on Safari to do Flash/JavaScript communicaton.

In addition, I've found that ExternalInterface is about two orders of magnitude slower than the older approach to do Flash/JavaScript communication, which is to use the SetVariable/GetVariable methods, along with TCallLabel and fscommands. If I pass about 100K over the Flash/JavaScript boundry using the old methods, it happens almost instantaneously (such as in AMASS), but if I use ExternalInterface it locks up the browser and takes about 10 seconds; again, this seems to be true cross browser and cross platform.

For this reason, as I'm bringin AMASS into dojo.storage, I am sticking with the older (if uglier) way of doing Flash/JavaScript communication, except for Safari, since I want to allow people to reliably persist large amounts of data (the ExternalInterface way of doing things was falling over at very low amounts of data, while the older way could handle megabytes of data).

Comments: Post a Comment



Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]