4 Replies Latest reply on Nov 3, 2009 2:58 AM by Semaj Snitram

    buddyAPI functions

    Semaj Snitram

      Greetings,

       

      i'm using buddyApi function "baGetFiles" in order to load .swf files.

      By default, the "baGetFiles" function is"files = baGetFiles( the moviePath & "images", "*.jpg", "", "My program", "Select pictures to import", 3, 100, 100 )" example given on buddyAPI help file).

       

      What i did was changing the "*.jpg" to "*.swf", now what i want to know is:

      Can i change the location of the files? Make it more dinamic? (a Windows explorer kind of window). I tried to change the parameter "the moviePath" to ("c:\....) but with no success. When i run the program, it opens the window but no files listed and no way of searching for them.

       

      In order to help you understanding what i'm talking about, this is the code that i wrote:

       

       

       

       

       

      on

       

      mouseup me

      files = baGetFiles(

      "c\" & "images", "*.swf", "", "Explorar", "Seleccione .swf", -2, 100, 100)

       

       

      --Folders = baFolderList("c\windows")

      end

       

      As you can see, i tried to use baFolderList too in order to get the "Windows explorer window kind of thing" but this choice led me to a "script error" (i loaded the xtra before creating the projector).

       

       

      Thanks in advance for the time spent and any help given on this .

        • 1. Re: buddyAPI functions
          Chunick Level 3

          Semaj Snitram wrote:

           

          Greetings,

           

          i'm using buddyApi function "baGetFiles" in order to load .swf files.

          By default, the "baGetFiles" function is"files = baGetFiles( the moviePath & "images", "*.jpg", "", "My program", "Select pictures to import", 3, 100, 100 )" example given on buddyAPI help file).

           

           

          on

           

          mouseup me

          files = baGetFiles(

          "c\" & "images", "*.swf", "", "Explorar", "Seleccione .swf", -2, 100, 100)

           

           

          --Folders = baFolderList("c\windows")

          end

           

          As you can see, i tried to use baFolderList too in order to get the "Windows explorer window kind of thing" but this choice led me to a "script error" (i loaded the xtra before creating the projector).

           

           

          Thanks in advance for the time spent and any help given on this .

          In your code you don't specify a valid path.

           

          "c\" & "images" should be "c:\" & "images", which would be more succinct as "c:\images" and that's assuming you have an images folder at the root of c:\ drive, or that you even have a c:\ drive (which most people do, I know, but you are still doing a lot of assuming).

           

          The question is, where on the user's hard drive do you want to open up the folder?... usually, if you're opening up a file dialog you want to try the desktop or the user's Documents folder... in which case you can use baSysFolder() like so:

           

          files = baGetFiles(baSysFolder("personal"), "*.swf", "", "Explorar", "Seleccione .swf", 7, -1, 100)

          1 person found this helpful
          • 2. Re: buddyAPI functions
            Semaj Snitram Level 1

            Hello Joshua and thanks for your help.

             

            I've already changed the "c\" to "c:\".

             

            The point here is, i want the final user to get the desired .swf in the location that he wants, not a specific one defined by me (similar to a "save file"/load file" window but specifically for .swf).

             

            My objective with this program (that i'm trying to create) is to create a protection for swf files that are recorded on a cd, in order to prevent their further manipulation, i intend to create a connection between director and flash (localConnection) and to create a portion of code to be imbued on flash.

             

            Don't know yet if i'm following the right path but i must try. For now i need to get the .swf file on director with this window.

            • 3. Re: buddyAPI functions
              Chunick Level 3

              Semaj Snitram wrote:

               

              Hello Joshua and thanks for your help.

               

              I've already changed the "c\" to "c:\".

               

              The point here is, i want the final user to get the desired .swf in the location that he wants, not a specific one defined by me (similar to a "save file"/load file" window but specifically for .swf).

               

              My objective with this program (that i'm trying to create) is to create a protection for swf files that are recorded on a cd, in order to prevent their further manipulation, i intend to create a connection between director and flash (localConnection) and to create a portion of code to be imbued on flash.

               

              Don't know yet if i'm following the right path but i must try. For now i need to get the .swf file on director with this window.

              You could always try the venerable but free FileXtra4 here: http://klkersten.com/xtras/FileXtra4/index.html

               

              it has the fx_FileOpenDialog() and the fx_FileSaveAsDialog() methods.

               

              in both cases, the path to the file is returned as a string... it's up to you to do what you need with that string such as using fileIO or byteArray to write out the file or read (load) the file.

               

              I don't own a copy of buddyAPI so I use it sparingly (2 functions for free)... but apparently, here's the pseudocode for file open and file save:
              Open -  
              set theFile = baGetFilename("Open", "C:\", "Filename", "Filters|*.*", Flags, "Instruction", Allow Folder Selection, X-Location, Y-Location )
              Save -  
              set theFile = baGetFilename( "Save", "C:\", "Filename", "Filters|*.*", Flags, "Instruction", Allow Folder Selection, X-Location, Y-Location )

              • 4. Re: buddyAPI functions
                Semaj Snitram Level 1

                Hello Joshua,

                 

                once again thank you for your help, this solves the problem. =D *thumbs up*

                I hope that one day i'll be able to help people like you and a lot of guys around do. =)