错误#2044:未处理IOErrorEvent :.文本=错误#2032:流错误 [英] Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error

查看:3641
本文介绍了错误#2044:未处理IOErrorEvent :.文本=错误#2032:流错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天, 使用AIR 3.5我的Andr​​oid / iOS应用工作。 在这个项目中,我下载ZIP文件,并在特定的文件夹中提取,使用的资产(IMG,XML和声音),我以后,一切都正常工作,但是当我加载的声音是让秀这个错误。 >错误#2044:未处理IOErrorEvent :.文本=错误#2032:流错误 我试着给它的静态位置,在Android的驱动器,但同样的错误发生。 我试图使用的URLRequest文件流,URLStream和同样的事情发生。 我跟踪的所有文件洗浴文件夹中,这给了我正确的浴。 这是code。

Good Day, I working in Android/IOS App using AIR 3.5. In this project I download ZIP file and extracted in specific folder, after that I using the assets ( IMG, XML and Sounds), everything work fine but when I load the sounds it's keep show this error. > Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error. I tried to give it static location in android drive but same error happened. I tried to use URLRequest, FileStream, URLStream and same thing happened. I traced all files bath in the folder and it's give me all the baths correct. This is the code.

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();
    }

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

Anyone can help me with this. Thank you

推荐答案

第一:为了解决这个问题未处理的异常的IOErrorEvent.IO_ERROR添加的addEventListener到的contentLoaderInfo 第二:Loader类可用于加载SWF文件或图像(JPG,PNG或GIF)文件(见的http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.html ),所以这个问题是在传递无效流(音streem)。 要播放的文件检查:的http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d25.html

First: To handle this unhandled exceptions add addEventListener for IOErrorEvent.IO_ERROR to contentLoaderInfo Second: Loader class is used to load SWF files or image (JPG, PNG, or GIF) files ( see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.html ) so the problem is in that you pass invalid stream (Sound streem ). To play a file check this: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d25.html

这篇关于错误#2044:未处理IOErrorEvent :.文本=错误#2032:流错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆