0 Replies Latest reply on Jul 14, 2010 11:54 PM by dineshmgkvp

    Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.

    dineshmgkvp Level 1

      Hi ,

       

      I am getting this error.

       

      Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.

       

      My complete source code ...

       

      I am trying to get the album art of mp3 song.

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
          <mx:Script>   
          <![CDATA[
              import mx.utils.ObjectUtil;
              import mx.containers.*;
              import mx.controls.*;
              import flash.net.URLRequest;
              import flash.display.Loader;
              import flash.events.Event;
              import flash.events.ProgressEvent;
              import mx.events.*;
              import flash.filesystem.File;
              import flash.filesystem.*;
             
              public function init():void
              {
                  var binaryData:ByteArray;            
                  var file:URLLoader = new URLLoader(new URLRequest("C://Raavan.mp3"));
                 
                 
                  var finalData:ByteArray = new ByteArray;
                  var byteCon:Loader = new Loader;
                  var offset:int;
                  var rLength:int;
                  var found:Boolean = false;
                  var end:Boolean = false;
                 
                  file.dataFormat=URLLoaderDataFormat.BINARY;
                  file.addEventListener(Event.COMPLETE,handleComplete);
                  
                  function handleComplete(e:Event):void
                  {    
                        binaryData = file.data as ByteArray;    
                        binaryData.position = 0;        
                         while(!found)
                         {        
                             var pos:int = binaryData.readUnsignedInt();       
                              if(pos == 0x41504943)
                              {           
                                   offset = binaryData.position + 20;        
                              }       
                              if(pos == 0)
                              {            
                                  if (!found)
                                  {                           
                                      rLength = binaryData.position - 1 - offset;                
                                      if(rLength > 5000)
                                      {          
                                          found = true;               
                                      }            
                                   }        
                              }        
                              binaryData.position = binaryData.position - 3;    
                              }    
                          finalData.writeBytes(binaryData, offset, rLength);    
                          finalData.position = 0;    
                          byteCon.loadBytes(finalData);
                         
                          img.addChild(byteCon);
                  }
              }

       

          ]]>
      </mx:Script>

       

      <mx:VBox height="600" width="600">
          <mx:Image id="img" />
          <mx:UIComponent id="ui">
             
          </mx:UIComponent>
         
      </mx:VBox>

       

      </mx:WindowedApplication>