actionscript 3 -错误#2044:Unhandled ioerrorprevention:.文本=错误#2



大家好!我使用AIR 3.5在Android/IOS应用程序中工作。在这个项目中,我下载ZIP文件并在特定文件夹中提取,之后我使用资产(IMG, XML和声音),一切工作正常,但当我加载声音时,它一直显示此错误。>错误#2044:Unhandled ioerrorprevention:。text=Error #2032: Stream Error.我试图给它在安卓驱动器的静态位置,但发生了同样的错误。我尝试使用URLRequest, FileStream, URLStream和同样的事情发生了。我追踪了文件夹里的所有文件,它给了我所有正确的文件。这是代码

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();
    }
任何人都可以帮我。谢谢你

第一:为ioerrovent添加addEventListener来处理这些未处理的异常。IO_ERROR到contentLoaderInfo第二:Loader类用于加载SWF文件或图像(JPG, PNG或GIF)文件(参见http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.html),因此问题在于您传递无效流(声音流)。要播放文件,请检查:http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d25.html

我们有类似的2032问题,并且是由于Apache 2.4升级而发现的。我们已经回滚了Apache,一切都很好!

我也得到这个错误,即使我正在处理ioerrovent…我想,但事实证明,在IOError事件之前触发了HTTPStatusEvent(在我的情况下为500),我在IOError事件之前删除了我的HTTPStatusEvent处理程序中的事件侦听器。Derp !

最新更新