저는 Actionscript 3를 처음 사용하고 Flash CS6을 사용합니다. - 난 재생하려는음악 재생을위한 mc 재생/일시 중지 단추를 전환 할 수 없습니다. 라이브러리에 내보내기 위해 연결된 음악 (AS)
은/countrymeadow라는 이름의
-countrymeadow.mp3이 도서관에서 액션 스크립트 (countrymeadow)에 대한 수출을 위해 연결되어 20 분 MP3를 일시 중지합니다.
재생 일시 중지 버튼은 버튼 내부의 첫 번째 프레임 (재생) 및 10 번째 프레임 (일시 중지)에서 중지됩니다.
AS3는 아래에 있지만 작동하지 않습니다. mc playpause 버튼은 테스트했을 때 '재생'과 '일시 중지'를 반복적으로 전환하므로 아무 소리도 재생되지 않습니다.
도움을 주시면 감사하겠습니다.
//set appearance of button, mode to true
playpause_mc.gotoAndStop("play");
playpause_mc.buttonMode = true;
//sound is stopped after loaded
var isPaused:Boolean = true;
//saves current position of sound
var currPos:int = 0.00;
var theSound:countrymeadow = new countrymeadow();
snd.play();
var soundCnl:SoundChannel = new SoundChannel();
//Listener updates after sound loads, and stops soundtheSound.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
function onComplete(evt:Event):void {
//Stop loaded sound
soundCnl.stop();
}
// movie clip button control
playpause_mc.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
if(isPaused){
//change state to playing, and play sound from position
isPaused = false;
soundCnl = theSound.play(currPos);
//reverse the appearance of the button
playpause_mc.gotoAndStop("pause")
//if sound completes while playing, run function
soundCnl.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
}else{
//it's playing, so save position and pause sound
currPos = soundCnl.position;
isPaused = true;
soundCnl.stop();
//change the appearance of the buttons
playpause_mc.gotoAndStop("play")
}
}
감사 어쨌든,하지만 난이 교체되어있어 이해하지 않습니다. 내 코드에서 무엇을 지켜야하며 무엇을 바꿀 수 있습니까? 그보다 더 좋은 예를 더 잘 보여줄 수 있습니까? 재 : 수정 내 코드가 포함되어 있습니다 ... – user1632767