Tomasz
Dmuchowski
Growth Hacker ?
Tworzę strategie
pozyskiwania ruchu i
kon...
Temat: start / pause i stop flash actionscript 3.0 audio
Witam mam pewien problem z playerem mp3, mam 2 przyciski: START / PAUSE i STOP
var pausePoint:Number = 0.00;
var isPlaying:Boolean;
var soundChannel:SoundChannel = new SoundChannel();
var sound:Sound = new Sound(new URLRequest("OIP1.mp3"));
xstop.addEventListener(MouseEvent.CLICK, clickStop);
xplay.addEventListener(MouseEvent.CLICK, clickPlayPause);
soundChannel = sound.play();
isPlaying = true;
function clickPlayPause(evt:MouseEvent) {
if (isPlaying) {
pausePoint = soundChannel.position;
soundChannel.stop();
isPlaying = false;
} else {
soundChannel = sound.play(pausePoint);
isPlaying = true;
}
}
function clickStop(evt:MouseEvent) {
if (isPlaying) {
soundChannel.stop();
isPlaying = false;
}
pausePoint = 0.00;
}
problem polega na tym, że muzyka jest grana automatycznie, jak zrobić aby zaczęła odtwarzanie dopiero po wciśnięciu Start