[RESOLVED] Error 1009 appearing attempting to play Sound
Haven't had an Error 1009 issue in awhile but tonight I got one trying to play an external .mp3 track. Seems i got a null object somewhere but I can't seem to locate it. After debugging, it seems to be an error in my playBtn reference but it seems have all the proper instances. Any idea where the problem may lie?
Here's the code:
Code:
import flash.media.SoundChannel;
stop();
pauseBtn.visible = false;
var snd:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
var lastPosition:Number = 0;
snd.load(new URLRequest("someAudio.mp3"));
pauseBtn.addEventListener(MouseEvent.CLICK, onClickPause);
function onClickPause(e:MouseEvent):void
{
lastPosition = myChannel.position;
myChannel.stop();
pauseBtn.visible = false;
playBtn.visible = true;
}
playBtn.addEventListener(MouseEvent.CLICK, onClickPlay);
function onClickPlay(e:MouseEvent):void
{
myChannel = snd.play(lastPosition);
pauseBtn.visible = true;
playBtn.visible = false;
}
Adam Bell
dzign@datatv.com
--
Over 90% of all websites
suck......
Join the minority.
Can you find out exactly what line throws that error? If I had to guess right now I'm assuming your playBtn or your pauseBtn doesn't have an instance name in it's properties on the stage.
Yes and No. Actually, that let me figure it out. I did place the instance of playBtn in the properties panel but only for the conclusion of the tween. Not the start. That's where the error was and I hate you have to do it twice to make the button work. But it works and I thank you Beathoven for the answer.
Adam Bell
dzign@datatv.com
--
Over 90% of all websites
suck......
Join the minority.