Alright. So I’ve viewed this forum many times for help, but I now need to ask a question of my own.
So I’m making a video that illustrates an mp3 narration. I decided to make the animations on my main timeline, (mostly textbook pages and highlighting) and I have loaded the *mp3 into a soundChannel *and this video is only supposed to have basic pause/play functionality that *pauses the sound and the time line.
*I’ll show you my code then explain the problem.
var soundRequest:URLRequest = new URLRequest("wk1_day1.mp3");
var soundLoader:Loader = new Loader;
var sound:Sound = new Sound;
** var soundControl:SoundChannel = new SoundChannel;**
** var pauseTime:Number = 0;**
sound.load(soundRequest);
pause_mc.alpha = 0;
pause_mc.visible = false;
play_mc.visible = true;
play_mc.buttonMode = true;
sound.addEventListener(Event.COMPLETE, loaded);
stop();
** function loaded(e:Event):void**
{
play_mc.addEventListener(MouseEvent.CLICK, playSound);
}
** function playSound(e:Event):void**
{
** soundControl = sound.play(pauseTime);**
play();
play_mc.visible = false;
play_mc.removeEventListener(MouseEvent.CLICK, playSound);
pause_mc.visible = true;
pause_mc.addEventListener(MouseEvent.CLICK, stopSound);
}
function stopSound(e:Event):void
{
** pauseTime = soundControl.position;
soundControl.stop();**
stop();
pause_mc.visible = false;
pause_mc.removeEventListener(MouseEvent.CLICK, stopSound);
play_mc.visible = true;
play_mc.addEventListener(MouseEvent.CLICK, playSound);
}
The time line pauses and the sound stops however the problem is with my soundControl = sound.play(pauseTime);
When I pause and play it’s as if I just muted the mp3 and then unmuted it. The mp3 stops, but *resumes not at the time I paused *but at the time it would be at if I hadn’t paused it at all.
I put in trace() statements on my pause time in both my play and stop methods, and they definitely are the same, but why is it playing at a different time then pausing?
I’ve made an mp3 player so I just ripped this code off of that, but my mp3 player was only 1 frame long… so maybe thats part of the problem??
Any corrections to my code, or even, suggesting a better way of doing this movie would be great!