3 Replies Latest reply on Jun 26, 2008 4:39 AM by Lukewig

    Director based file browser

      Is there any way to create a file browser with Director? Basically, a single folder on the users drive will contain various files... Director reads the folder, adds the filenames to its interface as a list. User clicks one (A PDF for example) and the file opens.

      Any Ideas?
        • 1. Re: Director based file browser
          Level 7
          So what is it you want - some way of obtaining a list of all files in a
          folder, or a "browse" dialog?
          Director's getNthFilenameInFolder() and FileIO's displayOpen() will do
          this, as will Buddy API - with Buddy's commands being more complete and
          • 2. Re: Director based file browser
            korkster911 Level 1
            Thanks for the response Sean.

            I'll look into the suggestions you made. I'm actually dealing with an original Flash based client project. At the 11th hour they realized "I can't pull dynamic files off the drive with Flash."

            In order to integrate the solution, I'll use Director to index the folders upon load and write an xml file to the drive. Then I'll use Flash to read the file and use a flash/Director behaviour to open the documents"

            • 3. Re: Director based file browser

              If you download the "One Sprite Demo' from http://www.lingoworkshop.com/Codelib/OSW/Downloads.php, look for a file in there called "TreeDemo_filebrowser.dir". Basically its demonstrating how to use the treeview widget. You could make it into a functioning filebrowser by changing the following line from

              -- example of changing the label
              myNodeTreeRef.SetNodeValue("Opening...", args.path )

              change to....

              -- open the selected file using BuddyAPI
              res= baOpenFile(pathToOpen, "Normal")
              if (res <> 0) then alert ("error " & res & " opening file")

              There's probably a few other things you might want to do (filter the file list, provide a different starting directory etc - but it might be a start)

              -- Luke