0
我正在爲Air iOS編寫遊戲。我有一個音頻文件,保存在與.fla文件相同的目錄中。下面是我使用的發揮它的代碼:ActionScript 3動態播放音頻時出錯
import flash.net.URLRequest;
var snd:Sound = new Sound(new URLRequest("507560_-BlastProcess-.mp3"));
snd.play(0, 40);
這是錯誤的thew空氣調試發射測試時,我得到:
[SWF] Spike%20Jungle.swf - 72668 bytes after decompression
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at SpikeJungle_fla::MainTimeline/frame1()[SpikeJungle_fla.MainTimeline::frame1:128]
at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent()
at runtime::AppRunner/run()
at ADLAppEntry/run()
at global/runtime::ADLEntry()
[UnloadSWF] Spike%20Jungle.swf
Test Movie terminated.
我該如何解決這個問題?
什麼是你的'MainTimeLine'類128線? – CyanAngel 2015-02-06 17:14:21
StreamError - 這是要找的文件,安全限制或者您正在播放未完全加載的文件 - 無法肯定地說,也許可以立即開始播放,但我會先等待裝載器發起一個Event.COMPLETE,然後才能播放。 – 2015-02-06 17:33:52
@AndreiNikolaenko我試過這個: 'import flash.events.Event; import flash.media.Sound; import flash.net.URLRequest; var s:Sound = new Sound(); s.addEventListener(Event.COMPLETE,onSoundLoaded); var req:URLRequest = new URLRequest(「HexagonForce.mp3」); (req); function onSoundLoaded(event:Event):void { var localSound:Sound = event.target as Sound; localSound.play(); }' 但我仍然得到相同的錯誤。 – EdwardCorrell 2015-02-09 14:44:37