First Time Flasher Needs Help With computeSpectrum AS3 Problems

Hi guys (& girls) new to the forums and new to flash. Trying to teach myself Flash and without someone to ask questions can be tricky. While my knowledge of Flash is minimal (and I am therefore unlikely to be able anyone else in return just yet) I do have a proven track record of contributing to a community and want to become an active member going forward.

I have a project that I am working on that will end up as a short (approx 3min) video. It is entirely made in Flash and contains a section that has a Sound Spectrum displayed using the computeSpectrum method.

For your reference, I used this training video to help me:

http://adobe.edgeboss.net/download/adobe/adobetv/gotoandlearn/computeSpectrum.mov

And it uses this AS3 code:

var s:Sound = new Sound(new URLRequest(“audio.mp3”));
s.play(0, 1000);

var ba:ByteArray = new ByteArray();

addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void
{
graphics.clear();
graphics.lineStyle(1, 0x00EE00);
graphics.moveTo(-1, 150);
SoundMixer.computeSpectrum(ba);
for(var i:uint=0; i<256; i++)
{
var num:Number = -ba.readFloat()200 + 150;
graphics.lineTo(i
2, num);
}

Now it all works fine and exactly as I want it to but it does throw up two problems that neither my brain or google can fix for me and I’m hoping that you can!

The main problem is that I can not find a way to remove the line from the screen once the audio clip finishes playing. The timeline continues into the rest of the frames but the green line stays put right in the middle of the screen. It does not continue to track the audio (I don’t need it to I just want rid of it) it just stays across the middle of the screen.

The second problem is that it throws up this error message;

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at untitled_fla::MainTimeline/frame595()

I think from what I have found online that I can eliminate this error by using this solution:

http://curtismorley.com/2007/11/18/flex-2-flash-actionscript-error-2044/

Only problem is that I am not totally confident that this will fix it and do not want to try it till the video is all complete. If any one can shed any light on that too, it would be very helpful.

I would greatly appreciate anyone that can at least point me in the right direction, thanks in advance.