2013-03-04 216 views
1

我遇到了Android的這個問題,但我解決了!但是在IOS中它不工作,我花了超過1天試圖解決它。 我跟蹤了文件夾中的所有內容,並且正確地給出了路徑,但當我調用聲音路徑加載它時,它會一直給我提供此消息。錯誤#2044:未處理的IOErrorEvent :. text =錯誤#2032:流錯誤

這是跟蹤

/var/mobile/Applications/A121170F-40A0-4FF8-B93B-238D2B09C797/Documents/story1/zipFolder/mp3/1.mp3 
1.mp3 
/var/mobile/Applications/A121170F-40A0-4FF8-B93B-238D2B09C797/Documents/story1/zipFolder/mp3/2.mp3 
2.mp3 
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error. 
    at buildPageAnimation::LoadAndSetAnimation/loadComplete()[D:\TestUnZipFile\Ipad-new methods for animations - unzip\src\buildPageAnimation\LoadAndSetAnimation.as:95] 
    at buildPageAnimation::LoadAndSetAnimation/loadComplete() 
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error. 
    at buildPageAnimation::LoadAndSetAnimation/loadComplete()[D:\TestUnZipFile\Ipad-new methods for animations - unzip\src\buildPageAnimation\LoadAndSetAnimation.as:95] 
    at buildPageAnimation::LoadAndSetAnimation/loadComplete() 

的結果,這是代碼

var soundFile:File = File.documentsDirectory.resolvePath('story1/zipFolder/mp3/'); 
    var files:Array = soundFile.getDirectoryListing(); 
    for (var i:uint = 0; i < files.length; i++) 
    { 
     trace(files[i].nativePath);// gets the path of the files 
     trace(files[i].name);// gets the name 
     var mySound:Sound = new Sound(); 
     var myChannel:SoundChannel = new SoundChannel(); 
     var lastPosition:Number = 0; 
     mySound.load(new URLRequest(files[0].nativePath)); 
     myChannel = mySound.play(); 
    } 

我試過,但像這樣的文件中的靜態路徑:/// C:/用戶/ MASTER /文檔/story1/zipFolder/mp3/1.mp3及其不起作用 請有人可以幫助我。

+0

在for循環中,您會在索引0處加載files.length時間文件.... URLRequest(files [0] .nativePath)); ...這是您的問題嗎? – 2013-03-04 10:55:02

+0

即使在這種情況下,它不會給我位置0的聲音,謝謝 – 2013-03-04 11:10:00

+0

當IOErrorEvent被nopt處理時引發錯誤,然後添加'mySound.addEventListener(IOErrorEvent.IO_ERROR,處理程序);'這將排序拋出的錯誤,但我認爲你必須找出爲什麼它不能訪問它 - 路徑不正確,訪問權限不足? – 2013-03-04 11:15:15

回答

1

我也想補充一點,謝謝。

我正在使用.nativePath給URLRequest,而不是.url。在模擬器(Windows)上,它的工作方式很好,但是我在iOS上遇到了此錯誤。考慮到我花了大約15分鐘來編譯遠程調試,我很放心,答案非常簡單。

相關問題