1 Reply Latest reply on May 6, 2011 9:55 AM by Joe ... Ward

    Error 2032 on loading file -- and how to install 2.6 SDK?

    alazarincrimson

      I'm new to AIR (although experienced in AS3 development) and am porting a project to AIR to run on desktop --

       

      I understand that to reference any loaded assets I need to use the File class and package my assets with the Air app.  I'm working for the moment with the CS5 IDE and using the Air publish settings to include the folders where my assets are (i.e. I add the folders, not the individual files, as there are many).

       

      When I try to load the first file, an xml file, via URLLoader I get a "2032" error -- an IOError, stream error.

       

      I'm a bit stumped.  I saw by googling that others had this problem but solved it with the SDK 2.6 -- I don't know if that's what I need, but I've downloaded it.  I don't know how to install it to use in the IDE -- I could work with FB4, so if someone knows how to install it for that, that's good too.  Is this even the solution.

       

      The code I'm using to get the correct path for my loaded assets is

       

       

      function getPath($path:String):String {

      var f:File = File.applicationStorageDirectory;

      debug(f.resolvePath($path).url)

      return (f.resolvePath($path).url);

      }

       

      and I use it thus
      caseLoader.addEventListener(Event.COMPLETE, caseLoaded);
      caseLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, error,false,0,true);
      caseLoader.addEventListener(IOErrorEvent.IO_ERROR, error,false,0,true);
      caseLoader.load(new URLRequest(getPath("Assets/config.xml")));
      Last question -- do URLLoaders and Loaders behave similarly under AIR?
      Thanks!

       

      Message was edited by: alazarincrimson

        • 1. Re: Error 2032 on loading file -- and how to install 2.6 SDK?
          Joe ... Ward Level 4

          The application files are in the applicationDirectory, not the applicationStorageDirectory (unless you intentionally copied them). So try changing:

          var f:File = File.applicationStorageDirectory;

          to

          var f:File = File.applicationDirectory;

           

          Updating the SDK can sometimes be done by copying the new AIR SDK into the SDK folder in Flash Pro. However, Flash Pro does define its own UI for AIR development, so it doesn't always work. (So make a backup.) In Flash Builder, it is generally easier. Copy an existing Flex 4.5 SDK folder and copy the AIR SDK over the existing files. Then use the Project Preferences > ActionScript Compiler dialog page to add the new SDK.

           

          Loaders work essentially the same in AIR. A small difference is that relative paths in Flash Player are resolved relative to the root SWF; in AIR they are resolved relative to the loading SWF.