2 Replies Latest reply on Feb 24, 2009 4:52 AM by LukeDD

    FileSystemTree

    LukeDD Level 1
      i'm trying to create a file browser using mx:filesystemtree. Users navigate to a certain directory where a file will be written to. so the filesystemtree selected path return me with something like C:\flex\somefolder\somefolder. At a later date I want to write a file to that directory but need to validate the dir. So I do the following:

      private function validateDir(dirPath:String):void{
      var dirString:String = dirPath;
      var dir:File = new File();
      dir.nativePath = dirString;
      //Alert.show(dirString);
      if(dir.exists){
      Alert.show('exists');
      } else{
      Alert.show('does not exist');
      }
      }

      The problem is that C:\flex\somefolder\somefolder. does not work but C:/flex/somefolder/somefolder works. What is the best possible way to get around this? Thank you in advance
        • 1. Re: FileSystemTree
          Jeff Swartz Level 3
          If you are using string literals, be sure to type backslashes twice. For example, "C:\\flex\\somefolder\\somefolder". But it sounds like you are using the selectedPath property of the FileSystemTree object; and if so, then that should not be the problem.

          You can use the selectedItem property of the FileSystemTree object. This property is a File object.

          Jeff
          • 2. Re: FileSystemTree
            LukeDD Level 1
            Thank you for the reply.

            Yes i am using the selectedPath, but it does not work. Could it be because i'm using the String() function?