1
我正在做一個by-the-book在Flex中的聲音播放,我聽不到它。
我嘗試這樣做:
var snd : Sound = new Sound();
snd.addEventListener(Event.COMPLETE, function(e : Event) : void
{
snd.play();
});
snd.addEventListener(IOErrorEvent.IO_ERROR, function(e : IOErrorEvent) : void
{
Log.format("Playing gong sound failed...\n{0}", e.toString());
});
snd.load(new URLRequest("http://localhost:8000/gong.wav"));
我試着更簡單:
var snd : Sound = new Sound(new URLRequest("http://localhost:8000/gong.wav"));
snd.play();
但我什麼也沒有聽見。在vlc中啓動相同的mp3文件可以很好地播放它。所以是的,我的揚聲器打開了。 :)
這不是加載。我可以看到它實際上正在加載這些40k字節的罰款,如果我給了錯誤的URL我做得到一個IOError。就好像它在玩,但什麼都聽不到。
+1鍵入完全相同的內容。 [Sound]的文檔(http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Sound.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6) –