종료
  • 글로벌 커뮤니티
    • 언어:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

AS3, Sound pause and rePlay

탐험가 ,
Feb 25, 2025 Feb 25, 2025

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);
	}

}

 

330
번역
신고
커뮤니티 가이드라인
게시판 이용시 매너를 지켜주세요. 콘텐츠의 원본 출처를 밝혀 주세요. 중복되는 질문이 있는지 확인해보신 후 게시물을 작성해주세요. 자세히 알아보기
community guidelines

correct answers 정답 1개

Adobe 직원 , Feb 27, 2025 Feb 27, 2025

[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

...
번역
Adobe 직원 ,
Feb 27, 2025 Feb 27, 2025

[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);

  }

}

 

해당 수식을 참고할 수 있을것 같습니다. 

번역
신고
커뮤니티 가이드라인
게시판 이용시 매너를 지켜주세요. 콘텐츠의 원본 출처를 밝혀 주세요. 중복되는 질문이 있는지 확인해보신 후 게시물을 작성해주세요. 자세히 알아보기
community guidelines
탐험가 ,
Feb 28, 2025 Feb 28, 2025
최신

Thank you for your kind comments.

번역
신고
커뮤니티 가이드라인
게시판 이용시 매너를 지켜주세요. 콘텐츠의 원본 출처를 밝혀 주세요. 중복되는 질문이 있는지 확인해보신 후 게시물을 작성해주세요. 자세히 알아보기
community guidelines