클립보드로 링크 복사
복사됨
There is an issue where the replay button does not work after a long pause (3 minutes or more) while playing music.
I don't know why.
var pausePosition: Number;
// stageOnOff => Video clip
stageOnOff.addEventListener(MouseEvent.CLICK, playpauseSelect);
var onOff: Boolean = false;
function playpauseSelect(e: MouseEvent): void {
onOff = !onOff;
if ( onOff) {
pausePosition = channel.position;
channel.stop();
} else {
channel = sound.play(pausePosition);
channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
}
}
[AS3] How to pause Movie Clip, Frame, and Sound at the same time?
글로벌 게시판에서 해당 내용을 참고해 봤습니다.
현재 재생 중인 모든 사운드와 정지 시의 위치를 배열로 유지할 수 있습니다.
그런 다음 올바른 위치에서 다시 시작할 수 있습니다.
만약 네 개의 사운드, a.mp3, b.mp3, c.mp3, d.mp3가 있고, 정지 버튼과 시작 버튼이 있다면, 이 코드는 모든 사운드를 재생하고, 이를 멈춘 후, 중단된 위치에서 계속 재생할 수 있게 해줍니다.
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.events.MouseEvent;
var files:Array = ["a.mp3","b.mp3","c.mp3","d.mp3"];
var sounds:Array = [];
var sound
...클립보드로 링크 복사
복사됨
[AS3] How to pause Movie Clip, Frame, and Sound at the same time?
글로벌 게시판에서 해당 내용을 참고해 봤습니다.
현재 재생 중인 모든 사운드와 정지 시의 위치를 배열로 유지할 수 있습니다.
그런 다음 올바른 위치에서 다시 시작할 수 있습니다.
만약 네 개의 사운드, a.mp3, b.mp3, c.mp3, d.mp3가 있고, 정지 버튼과 시작 버튼이 있다면, 이 코드는 모든 사운드를 재생하고, 이를 멈춘 후, 중단된 위치에서 계속 재생할 수 있게 해줍니다.
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.events.MouseEvent;
var files:Array = ["a.mp3","b.mp3","c.mp3","d.mp3"];
var sounds:Array = [];
var soundchannels:Array = [];
var soundpositions:Array = [];
startsounds();
stopbtn.addEventListener(MouseEvent.CLICK,stopsounds);
startbtn.addEventListener(MouseEvent.CLICK,playsounds);
stop();
function startsounds(){
var i:int;
var snd:Sound;
var chn:SoundChannel;
soundchannels = [];
for(i = 0;i< files.length;i++){
snd = new Sound(new URLRequest(files));
chn = snd.play();
sounds.push(snd);
soundchannels.push(chn);
}
}
function stopsounds(e:MouseEvent){
var i:int;
var chn:SoundChannel;
soundpositions = [];
for(i = 0;i< sounds.length;i++){
chn = soundchannels;
soundpositions.push(chn.position);
chn.stop();
}
}
function playsounds(e:MouseEvent){
var i:int;
var chn:SoundChannel;
soundchannels = [];
for(i = 0;i< sounds.length;i++){
chn = sounds.play(soundpositions);
soundchannels.push(chn);
}
}
해당 수식을 참고할 수 있을것 같습니다.
클립보드로 링크 복사
복사됨
Thank you for your kind comments.
새 Adobe 커뮤니티에서 더 많은 영감, 이벤트, 리소스를 찾아보세요
지금 바로 살펴보기