2011-08-23 3 views

답변

0

당신은 플레이를 호출하기 전에 소리 객체의 전체 이벤트에 대한 리스너 수있는 최고의

var s:Sound = new Sound(new URLRequest("url.com/file.mp3")); 
var channel:SoundChannel = new SoundChannel(); 
channel = s.play(); 

:

이 내 코드입니다. 또한 Sound.play()은 SoundChannel 객체를 반환하므로 인스턴스화 할 필요가 없으며 전체 핸들러의 범위 밖에있는 참조를 보유 할 변수를 정의하면됩니다.

var channel:SoundChannel; 
var s:Sound = new Sound(new URLRequest("url.com/file.mp3")); 
s.addEventListener(Event.COMPLETE,onSoundLoaded); 

function onSoundLoaded(evt:Event):void 
{ 
    s.removeEventListener(Event.COMPLETE,onSoundLoaded); 
    channel = s.play(); 
} 
+0

Shanethehat, thaks very much 완벽하게 작동합니다. –

관련 문제