This is my code:
- Code: Select all
play_Btn.addEventListener(MouseEvent.CLICK, play_Btn_Listener);
pause_Btn.addEventListener(MouseEvent.CLICK, pause_Btn_Listener);
who_Btn.addEventListener(MouseEvent.CLICK, who_Btn_Listener);
illus_Btn.addEventListener(MouseEvent.CLICK, illus_Btn_Listener);
sketch_Btn.addEventListener(MouseEvent.CLICK, sketch_Btn_Listener);
contact_Btn.addEventListener(MouseEvent.CLICK, contact_Btn_Listener);
play_Btn.enabled = false;
var request:URLRequest = new URLRequest("loop.mp3");
var sound:Sound = new Sound(request);
var soundChannel:SoundChannel = sound.play();
var soundPosition:Number;
function pause_Btn_Listener(event:MouseEvent):void {
soundPosition = soundChannel.position;
soundChannel.stop();
play_Btn.enabled = true;
pause_Btn.enabled = false;
}
function play_Btn_Listener(event:MouseEvent):void {
soundChannel = sound.play(soundPosition);
pause_Btn.enabled = true;
play_Btn.enabled = false;
}
function who_Btn_Listener(event:MouseEvent):void {
gotoAndPlay(32);
}
function illus_Btn_Listener(event:MouseEvent):void {
gotoAndPlay(72);
}
function sketch_Btn_Listener(event:MouseEvent):void {
gotoAndPlay(112);
}
function contact_Btn_Listener(event:MouseEvent):void {
gotoAndPlay(52);
}
Four buttons are navigation, and the other two are for sound control.
They all work fine excpet once I've clicked either illus_Btn, contact_Btn or sketch_Btn then the sound buttons no longer work! They only work again when I click on who_Btn...any ideas why?
Im starting to dislike Flash a lot!
Mike