2012-06-13 7 views
0

누구나 플래시에서 액션 스크립트로 나를 도울 수 있는지 알고 싶습니다.루프 사운드 액션 스크립트 플래시

나는 버튼을 클릭 할 때 다른 버튼과 다른 사운드 루프를 만들고 싶지만 모든 루프는 음악 멜로디 때문에 종료해야합니다. 누구든지 나를 도울 수 있습니까?

가 AS3에서의 SoundChannel 클래스를 사용하여 당신에게

테레사

답변

1

감사, 당신은 또는 addEventListener 얻을 수 있습니다 - 완전한 소리에 대해 알리는 것이다, 때 Event.SOUND_COMPLETE을 한 다음 다음 사운드를 재생할 수 있습니다

1

음 마지막 버튼을 누른 것과 관련된 소리를 재생하고 많은 소리를 함께 연주하지 않으려한다고 가정합니다.

그래서 당신은 당신이 버튼을 누를 때에 변경 글로벌 사운드 변수가

var sound:Sound=new Sound(new URLRequest("music.mp3")); 
var soundChannel:SoundChannel=new SoundChannel(); 
soundChannel=sound.play(); 
soundChannel.addEventListener(Event.SOUND_COMPLETE,loop_Sound); 
function loop_Sound(e:Event){ 
     soundChannel=sound.play(); 
     //I know you don't need to add the listener again to the sound channel 
     //but this is something i just do 
     soundChannel.addEventListener(Event.SOUND_COMPLETE,loop_Sound); 
} 
//call this function when the button is pressed 
//you could name the button name as the sound file's name 
//and use e.currenttarget.name or something 
function change_Sound(e:MouseEvent){ 
    sound=new Sound(new URLRequest("music2.mp3")); 

} 

이 버튼을 누를 때 사운드를로드하지만 현재의 사운드 버튼이없는 경우 재생 완료 경우에만 재생할 것 그것이 현재의 소리를 반복 할 것 인 동안 그것이 눌러지고있는 동안 눌렸다. 운의 베스트!!

관련 문제