PDA

View Full Version : sound spectrum problem



lope
December 13th, 2009, 02:05 AM
i have this in my enter frame while song plays:


if (_spectrumOpened && !SoundMixer.areSoundsInaccessible()) {
doLineSpectrum();
}

yet, its still tracing an error:

SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: file:///K|/flash%20%20sites%5Factionscript%203/%5F%5F%5F%5FCLASSES/mp3%20player%2044.swf cannot access . This may be worked around by calling Security.allowDomain.



function doLineSpectrum():void {

g.clear();
g.lineStyle(_spectrumLineThickness, _spectrumColor);
g.moveTo(0, spectrum_mc.spectrumBg_mc.height / 2);
try {
SoundMixer.computeSpectrum(_byteArr);

for (var i:int=0; i<256; i++) {
var num:Number = - _byteArr.readFloat() * _spectrumAmplifier + spectrum_mc.spectrumBg_mc.height / 2;
g.lineTo(i * _spectrumLength, num);
}
} catch (er:Error) {
trace(er);
}
}

if this returns false: !SoundMixer.areSoundsInaccessible() why am i getting Security sandbox violation ?