1 Reply Latest reply on Jan 5, 2009 1:33 AM by Dr. Fred Mbogo

    Writing in to a Text file in Vista 32 OS

    rahimhaji Level 1
      Dear Friends,

      I have developed a standalone ticker in Adobe AIR, in that iam storing setting options in a local text file. It is working fine in XP.

      but when i install my application(ticker) in Vista32 OS, when i do changes in my setting file, i have to write the changes in local text file. it is not writing the modified setting text in the text file. my coding is:

      function writefile() {

      tempscr1=3;

      var finalstr2:String = "smallwinmode="+smscr+"&speed="+setmc.tickeropt.sld.s.value+"&alert="+altval+"&maxi="+max ifeed+"&alwtop="+setmc.tickeropt.aifch.selected+"&prescr="+tempscr1+"&prescrx="+newwindow3 .x+"&prescry="+newwindow3.y+"&firstinstal="+fins;
      var dskTopFileStream2:FileStream = new FileStream();
      var dskTopFile2:File = File.applicationDirectory;
      var fileString2:String = (dskTopFile2.nativePath + "\\settings.txt");

      dskTopFile2 = dskTopFile2.resolvePath(fileString2);

      dskTopFileStream2.openAsync(dskTopFile2, FileMode.WRITE);
      dskTopFileStream2.writeUTFBytes(finalstr2);
      dskTopFileStream2.close();
      }

      Anybody can help me. if it works in Vista also i can release my product, i got struct up... kindly tell me should i change my coding to write txt file in Visa? pls help me....


      Thanks in advance,
      Syed Abdul Rahim
        • 1. Re: Writing in to a Text file in Vista 32 OS
          Dr. Fred Mbogo Level 1
          Your user probably doesn't have permission to write to the application directory. The OS is right to protect the program directory.

          You should be writing data files into the user's home directory somewhere. All of the other "somethingDirectory" properties of File name such directories. For files that the user doesn't actually work with directly, I prefer applicationStorageDirectory myself. For files you are writing out for the user to see, I'd use documentsDirectory instead.