9 Replies Latest reply on Jun 5, 2007 12:43 PM by Newsgroup_User

    Passing a parameter at startup of SWF

    BobAchgill
      How can I code my script to receive a passed parameter into a variable
      e.g.
      MyFlashMovie.swf MyPassedParameter
        • 1. Re: Passing a parameter at startup of SWF
          Level 7
          BobAchgill wrote:
          > How can I code my script to receive a passed parameter into a variable
          > e.g.
          > MyFlashMovie.swf MyPassedParameter

          in the html pages object/embed tags...

          MyFlashMovie.swf?myFirstParameter=val1&mySecondParameter=val2
          • 2. Re: Passing a parameter at startup of SWF
            Level 7
            >> How can I code my script to receive a passed parameter
            >> into a variable e.g.
            >> MyFlashMovie.swf MyPassedParameter

            > in the html pages object/embed tags...
            >
            > MyFlashMovie.swf?myFirstParameter=val1&mySecondParameter=val2

            That's it, neat and sweet. Make sure to add your name/value pairs to
            the SWF reference in *both* your object and embed tags. Alternatively, you
            can use FlashVars attributes (search Adobe.com for "FlashVars").

            Either way, the passed in name/value pairs become instantly accessible
            String variables in the main timeline. If you want those values in other
            datatypes (Boolean, Number, etc.) you'll have to account for that.


            David Stiller
            Adobe Community Expert
            Dev blog, http://www.quip.net/blog/
            "Luck is the residue of good design."


            • 3. Re: Passing a parameter at startup of SWF
              BobAchgill Level 1
              Would it be the same if started and passed from the command line?

              Thanks!

              Bob
              • 4. Re: Passing a parameter at startup of SWF
                Level 7
                Bob.

                > Would it be the same if started and passed from the command line?

                Command line? Are you saying this SWF won't be embedded in an HTML
                document?


                David Stiller
                Adobe Community Expert
                Dev blog, http://www.quip.net/blog/
                "Luck is the residue of good design."


                • 5. Re: Passing a parameter at startup of SWF
                  BobAchgill Level 1
                  Specifically I want to pass the parameter like this from with in my VB.Net program ...

                  AxShockwaveFlash1.Movie = MyFlash.swf MyPassedParameter
                  AxShockwaveFlash1.Play()
                  AxShockwaveFlash1.Loop = True

                  I am successful with playing of Flash imbedded in my VB.Net program ...now I want to add passing the Parameter. If this can't be done can you suggest another way to pass the parameter in??? I know I can write a load variables file to disk with the parameter and have the swf read it in that way ... but I don't want to have to write to the disk to pass the parameter.

                  The reason I said "command line" is because I thought that this would be the same as passing a parameter in a bat file or directly from the Windows Run command line.

                  • 6. Re: Passing a parameter at startup of SWF
                    Level 7
                    Bob,

                    > Specifically I want to pass the parameter like this from with in my VB.Net
                    > program ...

                    Aha. Well, shoot ... that goes out of my personal experience. But if I
                    were in your shoes, I would try appending that parameter in as a query
                    string to the file reference, like this:

                    AxShockwaveFlash1.Movie = MyFlash.swf?MyPassedParameter=MyParameterVal

                    I'm not certain that'll work, but that would be my very first try.


                    David Stiller
                    Adobe Community Expert
                    Dev blog, http://www.quip.net/blog/
                    "Luck is the residue of good design."


                    • 7. Re: Passing a parameter at startup of SWF
                      BobAchgill Level 1
                      Thanks! It works. :o)
                      • 8. Passing a parameter at startup of SWF
                        BobAchgill Level 1
                        It works when I have the swf and flv in the same directory but ... how do I qualify the path for the passed parameter when the two are not in the same directory?

                        I tried something like...
                        AxShockwaveFlash1.Movie = C:\MyFlash.swf?MyPassedParameter=C:\test\MyParameterVal.flv

                        The movie displays but it can not find the file MyParameterVal.flv
                        • 9. Re: Passing a parameter at startup of SWF
                          Level 7
                          BobAchgill,

                          > It works when I have the swf and flv in the same directory but ...
                          > how do I qualify the path for the passed parameter when the two
                          > are not in the same directory?

                          In the HTML world, those variables are urlencoded, so I'd try the same
                          here.

                          > I tried something like...
                          > AxShockwaveFlash1.Movie =
                          > MyFlash.swf?MyPassedParameter=C:\test\MyParameterVal.flv

                          Give this a shot.

                          MyFlash.swf?MyPassedParameter=C%3a%5ctest%5cMyParameterVal.flv


                          David Stiller
                          Adobe Community Expert
                          Dev blog, http://www.quip.net/blog/
                          "Luck is the residue of good design."