5 Replies Latest reply on Dec 1, 2006 1:43 AM by duckets

    File requestor window

    cratica Level 1
      I searched this forum, the help and the 3 books I have on Director and I can't find this topic which is strange since it is a very basic need.

      I want to have a file requestor window in my movie that reads and displays all the files in a certain directory with a certain extension. It would need to have scroll buttons as well if there are a lot of files found. The only other strange thing I need it to do is display the filenames it finds without the extension shown (just display the filename body). I would have thought this would be a built in behavior but it's not as far as I can tell.

      Can anyone point me to where i can learn how to add this functionality?

      Thanks a bunch!

        • 1. Re: File requestor window
          duckets Level 1

          Here's a basic 'file open' dialogue:

          fileio = xtra("fileio").new()
          selectedFile = fileio.displayOpen()

          or for more advanced functionality, check out the 'GetFilename' function of the buddy api xtra: http://www.mods.com.au/budapi/

          hope this helps!

          - Ben
          • 2. Re: File requestor window
            cratica Level 1
            Thank you. I guess I should be more specific. I am able to open a file and have done that in my past projects. What I want now is a scrollable window that displays all the files of a given extension in a given directory. I then use the cursor to double click on which file I want. Then the fileio commands come into play.

            So...how do I create the scrollable window and that displays the files?

            • 3. Re: File requestor window
              Level 7
              I will 2nd the notion that Duckets has told you already. Use BuddyAPI.
              It has a command called baGetFileName that will do just what you are

              I don't use fileIO, but I think that if you want to stay with it, the
              setFilterMask() command is what you need to only show jpgs (or whatever
              extension you want)

              But seriously, Buddy is the easiest way to do this by far.
              • 4. Re: File requestor window
                cratica Level 1
                Hmm. Ok, thank you Mike and Duckets. I will check your recommendations out...
                • 5. Re: File requestor window
                  duckets Level 1
                  Or, if you really want to "roll your own" file selector, you can use the buddy API commands 'baFileList' and 'baFolderList' to get a list of the files and folders in a particular directory. You'd then want to put thes into a text field. Set the framing to 'scroll' in the property inspector, then add some lingo to detect which line is clicked on, and act upon it.

                  But yes - unless you want to do this in a special custom visual style, use buddyAPI - otherwise you're just re-inventing the wheel!

                  - Ben