actionscript-3 - 错误#2044:未处理的IOErrorEvent :。 text =错误#2032:流错误

标签 actionscript-3 audio air-native-extension filestreams

美好的一天,
我使用AIR 3.5在Android / IOS App中工作。
在该项目中,我下载了ZIP文件并提取到了特定的文件夹中,然后使用 Assets (IMG,XML和声音),一切正常,但是当我加载声音时,它会一直显示此错误。
>错误#2044:未处理的IOErrorEvent :。 text =错误#2032:流错误。
我试图给它在Android驱动器中的静态位置,但是发生了同样的错误。
我尝试使用URLRequest,FileStream,URLStream并发生了同样的事情。
我在文件夹中跟踪了所有文件Bath,它使我所有的Bath正确无误。
这是代码。

trace('AliSoundFile/' + ob.sound);          
var soundFile:File = File.documentsDirectory.resolvePath('AliSoundFile/'+ob.sound);
var files:Array = soundFile.getDirectoryListing();
            trace((File.documentsDirectory.resolvePath('AliSoundFile/'+ob.sound).nativePath) );
//sound = new Sound( new URLRequest ('AliSoundFile/1.mp3'));
sound.addEventListener(IOErrorEvent.IO_ERROR, sound_ioError);
for ( var i:uint = 0 ; i < files.length ; i++)
{
      if (files[i].isDirectory )
    {
       var arr:Array = files[i].getDirectoryListing();
        for ( var j:uint = 0 ;  j <  arr.length ; j++)
        trace('J:-> ',arr[j].nativePath);
    }
    trace('I:-> ',files[i].nativePath);
}
soundStreen = new FileStream();
soundStreen.openAsync(soundFile, FileMode.READ);
soundStreen.addEventListener( Event.COMPLETE, soundStreen_complete); 
soundStreen.addEventListener( IOErrorEvent.IO_ERROR, soundStreen_ioError); 
trace('end');
    private function soundStreen_complete(e:Event):void 
    {
        var ba:ByteArray = new ByteArray(); 
        soundStreen.readBytes( ba );
        _loadSound = new Loader();
        _loadSound.contentLoaderInfo.addEventListener( Event.COMPLETE, soundLoadbytesComplete );
        _loadSound.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadSound_progress);
        _loadSound.loadBytes( ba );
    }

    private function soundLoadbytesComplete(e:Event):void 
    {
        sound.play();
        sound = e.currentTarget.content as Sound;
        soundStreen.close();
    }

任何人都可以帮助我。
谢谢

最佳答案

第一:要处理此未处理的异常,请将IOErrorEvent.IO_ERROR的addEventListener添加到contentLoaderInfo
其次:Loader类用于加载SWF文件或图像(JPG,PNG或GIF)文件(请参阅http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.html),因此问题在于您传递了无效的流(Sound streem)。
要播放文件,请检查以下内容:http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d25.html

关于actionscript-3 - 错误#2044:未处理的IOErrorEvent :。 text =错误#2032:流错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15106960/

相关文章:

ios - ld : Framework not found: DropboxSDK

flash - 5000 : The class '..' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type

actionscript-3 - 在AS3中创建带有阴影的文本

c++ - 做个圈子把别人推开?

html - 浏览器卡在加载音频文件上

java - 在 Adob​​e Air Extension 中向 Android 添加 Activity

php - 将带有图像文件的多部分/表单数据从 Actionscript 发送到 PHP

java - 播放背景音乐android错误

java - 我可以使用 OpenAL 生成合成声音吗?

Android(检测外部 sd 卡)isExternalStorageRemovable 可以与 AS3 Adob​​e Air 一起使用吗?