4 Replies Latest reply on Nov 14, 2007 8:14 PM by Sketch24

    baOpenfile with variable name

      Hi I was wondering if it's possible to use baOpenFile() to open a file using a variable name. Like selectImg = coco.jpg
      getURL('lingo: baOpenFile(_movie.path & selectImg , "Normal")');
      this is the command in the flash file. If I use a specific name like GA-VE4-IMG1.jpg instead of the variable name it's work.
      the file browser of xp open and display the file. What's weird is when I use the variable without the " " instead of a file name it open windows explorer ..... wooh! any clue on how to solve my problem.

        • 1. Re: baOpenfile with variable name
          robdillon Most Valuable Participant
          You'll find that a lot of xtras have problems concatenating file paths using variables. The solution is to put the whole path into a variable:
          selectImg = _movie.path & "GA-VE4-IMG1.jpg"
          • 2. Re: baOpenfile with variable name
            Sketch24 Level 1
            it does'nt work, nothing happend. Don't forget that I'm in flash so if my variable is
            selectImg = _movie.path & "GA-VE4-IMG1.jpg" the result is 0. And I cannot use the specific name cause it come to the point before. If I use direclty
            getURL('lingo: baOpenFile(_movie.path & "GA-VE4-IMG1.jpg", "Normal")'); it's working but it has to be dynamic cause if I have 50 images, i don't want to use 50 line of script. Right now
            _global.selectImg = etage + "-" + systeme + "-IMG1.jpg";

            it use the floor (etage) variable and system (systeme) variable to define the name of the file to open. ex: GA-VE1-IMG1.jpg = (garage)-(VE1 system)-Image1.jpg. When I go to an other system i use the same code and the file change dynamicly to GA-A2-IMG2.jpg etc.. like that If i have 10-25 systems, i dont have to touche the code again. All i want to do is to lauch the jpg. I was using the getURL within flash but bacause it's in director getURL does'nt work anymore. BuddyAPI is a good xtra but if I can't use variable it's not that good.
            • 3. Re: baOpenfile with variable name
              robdillon Most Valuable Participant
              Then the simple solution is to just pass the file name that you want to use and not the movie path. Just do this from your Flash movie:


              and then in the Director movie use a getURL function to intercept the string that you send. Something like this:

              on getURL me, string
              fileToUse = _movie.path & string

              Attach that to the Flash sprite and it should do the job
              • 4. Re: baOpenfile with variable name
                Sketch24 Level 1
                thanx for the help it's working :)