1 Reply Latest reply on Mar 25, 2008 7:42 AM by john isaacks

    saving file bug?

    john isaacks Level 1
      sometimes I am noticing that when saving a file, if I define the file inside a function it gets what seems to be a bug.

      I have this code:
      var newFile:File = File.desktopDirectory.resolvePath("tab_icons/myimage.png");
      which results in saving this on my desktop:
      C:\Documents and Settings\jisaacks\Desktop\function Function() {}\tab_icons\myimage.png\function Function() {}

      its seems it is adding \function Function() {} before and after the string I pass.

      if I define the file in the begening of the code outside the function there is no problem.


      the app I am noticing this in is pretty complex, when I tried to simulate the same thing by creating a new blank file and just making a function to define the file and save it, it did not produce the bug so I am not sure exactly what in my code is making this happen. I can post my entire code if requested.

        • 1. Re: saving file bug?
          john isaacks Level 1
          ok I have pinpointed the problem to this function:

          Array.prototype.in_array = function( what ) {
          for( var a = 0; a < this.length; a++ ) {
          if( this[a] == what ) {
          return true;
          }
          else if( this[a] is Array ) {
          return this[a].in_array( what );
          }
          }
          return false;
          }

          this function has nothing to do with saving files, but whenever I remove this function and any calls to it, I no longer have a problem, I wonder if there is something in here that messes with the built in code?