To whom it may concern...
Hi...I just try to implement a very easy flash player ( just stop / play buttons ). And when you press play - it plays. The problems is that you can still press 'play' button while the song is playing and it still loads the song making it overlaid with sound.. I tried to imply enabled = false, the button greys out - and still works ! it's AS3..
Thank you.
Hi...I just try to implement a very easy flash player ( just stop / play buttons ). And when you press play - it plays. The problems is that you can still press 'play' button while the song is playing and it still loads the song making it overlaid with sound.. I tried to imply enabled = false, the button greys out - and still works ! it's AS3..
Code:
var soundRequest:URLRequest = new URLRequest("[URL unfurl="true"]http://localhost/tests/sound/s1.mp3");[/URL]
var sound_:Sound = new Sound();
var soundControl:SoundChannel = new SoundChannel();
sound_.load(soundRequest);
playButton_.addEventListener(MouseEvent.MOUSE_DOWN, playSound);
stopButton_.addEventListener(MouseEvent.MOUSE_DOWN, stopSound);
function playSound(event:MouseEvent):void {
soundControl = sound_.play();
playButton_.enabled = false;
gotoAndStop(2);
}
====Frame 2===
function stopSound(event:MouseEvent):void
{
soundControl.stop();
}
Thank you.