problem with mvie sound not playing automatically
hi there
i'm a bit of a novice when it comes to flash and as3 but I have manged to put together an animation with a voiceover. The voiceover plays along and parts of the animation correspond to what is being said in the voiceover so it's imperative that they play together.
I've managed to add a play and pause button which are working ok however the animation starts playing automatically when testing but the voiceover doesn't. You have to click the pause button foloowed by the play button to get the voiceover to play. Once that's done the play and pause buttons work perfectly. However, they voiceover and animation need to start at exactly the same time as the voiceover references the animation.
I hope I'm making sense!! I'm so close to getting this working but I just can't seem to figure this out. Any help would be much appreciated as I'm getting quite lost with as3!!
I have 3 layers in the flash file, one with the content (movieclip called dude), one with the play/pause buttons (go and halt) and the actionscript (see below).
import flash.events.MouseEvent;
var mySound:Sound = new voiceover();
var myChannel:SoundChannel = new SoundChannel();
var lastPosition:Number = 0;
var soundIsPlaying:Boolean = true;
go.addEventListener(MouseEvent.CLICK, startplaying);
function startplaying(event:MouseEvent):void{
dude.play();
if(!soundIsPlaying){
myChannel = mySound.play(lastPosition);
}
}
halt.addEventListener(MouseEvent.CLICK, stopplaying);
function stopplaying(event:MouseEvent):void{
dude.stop();
lastPosition = myChannel.position;
myChannel.stop();
soundIsPlaying = false;
}
I'd really appreciate any help as my deadline is looming and I'm so stuck on this last hurdle!
Thanks in advance ![]()
