Weird security problems with SoundMixer.computeSpectrum()
Ever tried to use SoundMixer.computeSpectrum() on a dynamically loaded audio file in AS3? I have run into some strange security problems. In my Flash CS3 IDE, it works fine the first time I run the movie, but then shutting down the movie and running it again throws a security exception “SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: ... cannot access .” This is despite the fact that the Flash movie definitely has explicit access to the local filesystem, and there is no real violation of the sandbox model as far as I can see.
Running the same movie in the browser, I find that IE7 with Flash Player 9 runs everything fine, but Flash Player in Firefox throws the same error.
I haven’t yet found a solution, other than catching the exception and trying to do something intelligent at that point. In my case I am using the spectrum to animate an “equalizer” type waveform clip; if the computeSpectrum() call fails, I simply fake the waveform instead (it looks surprisingly good with random data).
There is also a (probably) related problem that does not allow two separate Flash movies within the same browser process to access sound files for manipulation simultaneously - this webpage suggests that we are probably looking at a Flash Player bug for an explanation of that one. I have a feeling what I am seeing is a bug as well …

