Monday, 19 April 2010

Flash Quirks

IE Reserved Words for Method Names (and lack of debug message support?)

You know Internet Explorer is flakey when naming a method "play" or "stop" causes IE6,7,8 to give JavaScript errors.

A note for those with similar problems, this code cannot be used in IE.
ExternalInterface.addCallback("play", play);
ExternalInterface.addCallback("stop", stop);

In my case, it gave this cryptic error: "オブジェクトでサポートされていないプロパティまたはメソッドです。" On line 48 of some unknown file. It took a little while to figure out what was going on!

Having done almost all of my debugging in Firefox, Chrome and Safari to date, I also didn't realise that IE won't correctly render uncaught Flash exceptions. NPAPI browsers seem to render these fine as popups but IE gives a similar confusing error to the above.

The Windows 7 64-bit SoundChannel Bug

Yet another sneaky little Flash 10.x bug that won't rear its ugly little head until you start using a 64-bit Win7 machine. The class creates a instance every time you play a sound. An audio player app I made for work creates a new SoundChannel every time the user seeks in the audio file. Internally flash has a limit of  32 concurrent sounds it will mix.

On Win7 though, the mixing channel is not freed when the sound stops. It seems to persist for the lifespan of the SoundChannel instance. This, coupled with an infrequent garbage collection sweep interval makes it possible that all available mixing slots are in use, even though no sound is playing. I can't seem to find a reference to this particular bug elsewhere on the web. Anyone else seen this one? Any workarounds?