1 Reply Latest reply on Jun 30, 2008 9:29 AM by Damon Edwards

    Can i add extension to my FILE?

    LucaL8
      On AIR i can use FILE object to open a file from my local PC by the browseForSave method.
      So i create the file with the name that user type in the box, but i eant to add to this name the extension (for example ".txt"). I don't find any method or property to do this and the property "extension" or "name" are read-only property.

      So, how can i do this?

      Thanks to all boys!
        • 1. Re: Can i add extension to my FILE?
          Damon Edwards Level 3
          This is append the .txt extension if there is no extension specified, or if the extension isn't txt.. you can change that anything:
          file.addEventListener(Event.SELECT, saving);
          function saving(e:Event):void{
          file = File(e.target);
          if(!file.extension || file.extension != "txt"){
          file.nativePath += ".txt";
          }
          };

          *would have used the attach code, however, doesn't seem to be there anymore!!!??!!