2 Replies Latest reply on Aug 12, 2010 7:00 AM by VRPDeveloper

    Need Help with openWithDefaultApplication()

    flexillu10 Level 1

      I can open Adobe Illustrator files stored locally on the hard drive by calling openWithDefaultApplication() on the file path.

       

      However when i select a file that is stored on a server it doesn't work because it converts the file location to a file path

       

      e.g http://someserver/images/image5.ai

       

      becomes http:\\someserver\images\image5.ai, and obviosuly, this file doesn't exist and i get an error saying so.

       

      So how can i call openWithDefaultApplication() on a file stored on my server?

        • 1. Re: Need Help with openWithDefaultApplication()
          VRPDeveloper Level 3

          You can do something like this

           

          var loader:URLLoader = new URLLoader();
          loader.dataFormat = URLLoaderDataFormat.BINARY;
          loader.addEventListener(Event.COMPLETE,
              function(e:Event):void
              {
                  var air:File = File.userDirectory.resolvePath("Downloads/AdobeAIR.dmg");
                  var fs:FileStream = new FileStream();
                  fs.open(air, FileMode.WRITE);
                  fs.writeBytes(loader.data);
                  fs.close();
                  air.downloaded = true;
              });
          var req:URLRequest = new URLRequest("http://airdownload.adobe.com/air/mac/download/latest/AdobeAIR.dmg");
          loader.load(req);

           

          If this post answers your question or helps, please kindly mark it as such.

          1 person found this helpful
          • 2. Re: Need Help with openWithDefaultApplication()
            flexillu10 Level 1

            VRPDeveloper wrote:

             

            You can do something like this

             

            var loader:URLLoader = new URLLoader();
            loader.dataFormat = URLLoaderDataFormat.BINARY;
            loader.addEventListener(Event.COMPLETE,
                function(e:Event):void
                {
                    var air:File = File.userDirectory.resolvePath("Downloads/AdobeAIR.dmg");
                    var fs:FileStream = new FileStream();
                    fs.open(air, FileMode.WRITE);
                    fs.writeBytes(loader.data);
                    fs.close();
                    air.downloaded = true;
                });
            var req:URLRequest = new URLRequest("http://airdownload.adobe.com/air/mac/download/latest/AdobeAIR.dmg");
            loader.load(req);

             

            If this post answers your question or helps, please kindly mark it as such.

             

            is this code downloading the file yes? how will it know to open the file with adobe illustrator?