9 Replies Latest reply on Dec 15, 2006 8:53 AM by _postdBy(Vern);

    Passing querystring variable using activex bypass scripts

    _postdBy(Vern); Level 1
      I have been using menu systems with carats that position themselves according to variables passed in the URL string. This setup uses JS to parse to the variables and include them in a script that writes the Flash code in the HTML doc. With the advent of MS wonderful activex control, I need to figure out how to incorporate variable that are parsed into that AC_FL_RunContent() function.

      If anyone knows what I mean and has some solution, I would be very thankful.
        • 1. Re: Passing querystring variable using activex bypass scripts
          Level 7
          _postdBy(Vern);

          > With the advent of MS wonderful activex control,
          > I need to figure out how to incorporate variable
          > that are parsed into that AC_FL_RunContent()
          > function.

          If AC_FL_RunContent() doesn't support variables in the way you need, it
          certainly should -- but truth be told, I haven't tried it and simply don't
          know. What I do know is that Geoff Stearns' SWFObject supports variables.
          Have you tried that solution? It not only handles the IE Active Content
          issue, but also lets you sniff for Flash Player release versions.

          http://blog.deconcept.com/swfobject/
          http://www.adobe.com/devnet/flash/articles/swfobject.html


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


          • 2. Re: Passing querystring variable using activex bypass scripts
            _postdBy(Vern); Level 1
            Thank Dave, I appreciate the direction. I have not used Geoff's script, but looking over the links you supplied, it looks like it will do the trick!

            Thanks so much for your help!!
            • 3. Re: Passing querystring variable using activex bypass scripts
              _postdBy(Vern); Level 1
              Well. That script is certainly the answer, I have made it work in testing on my own site. Now to a different server, different site, it breaks. After some testing, I have found that the problem is related to the query string. Here is what is happening:

              I get no Flash movie, just a blank. If I remove the ?variable=12 from the query string, it works. So I began adding it back slowly to find out where it breaks. I stil works with the ? in it, but once I add a variable name, no more Flash is displayed. I didn't have this problem in my tests on my own server. So I tried a different SWF to see if somehow I had an error, and the same thing happens.

              Has anyone had this issue or know what to look for? At this point, I am stumped.

              Thanks!

              • 4. Re: Passing querystring variable using activex bypass scripts
                Level 7
                Vern,

                > If I remove the ?variable=12 from the query string,
                > it works. So I began adding it back slowly to find
                > out where it breaks.

                Troubleshooting rocks.

                > I stil works with the ? in it, but once I add a variable
                > name, no more Flash is displayed. I didn't have this
                > problem in my tests on my own server.

                That's actually pretty puzzling. I can't think of a reason why this
                should work on one server and not another.

                > Has anyone had this issue or know what to look for?
                > At this point, I am stumped.

                Rather than using a query string, use SWFObject's addParam() or
                addVariable() methds, as described on Stearns' site, or here:

                http://www.quip.net/blog/2006/flash/how-to-tell-swf-from-outside


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


                • 5. Re: Passing querystring variable using activex bypass scripts
                  _postdBy(Vern); Level 1
                  Well, I need to pass the varibles through the URL querystring in order to adjust the menu each time. Each page loads the same Flash file, but with a different value for the varaible named 'ctPos' which means 'carat position'. My code in the SWF places the carat according the page being loaded. I am posting a couple of links if you (Dave) or anyone else want to take a peek. This is so odd.

                  This first link work fine, you can change the value of ctPos and see the carat change positions. It all works fine.

                  http://www.pc-grafix.com/flash/test.php?ctPos=150

                  Now the exact same code, same files, everything the same, breaks when tried in THIS website. Can't understand this for the life of me. Once you are at the page, go ahead and add a variable name and value, or just a single letter or number and the script breaks. So strange.

                  http://www.digitalofficesolutions.biz/test_02.html?ctPos

                  If you just remove the ctPos after the question mark, all is well. It is NOT the server, that is for sure. I place the exact same files from above into this site and THOSE work, but I can't seem to get them to work here. I have also replace the entire swfobject.js file, not copy and paste, but 'save as' from a working source. Still no joy. It has to be down to the code used to display, but I have retyped it multiple time and nothing changes.

                  At this point I am sure I am going to feel pretty stupid when someone says "hey, what about ...." and that fixes it. But by now, I am ready to feel as stupid as it takes! :)

                  Thanks again!
                  • 6. Passing querystring variable using activex bypass scripts
                    _postdBy(Vern); Level 1
                    After I posted the above, I changed the default text in the non-working file that says "This text is replaced by the Flash movie." and the thing starts to work. I quickly changed it back, us "ctrl+z" and the thing STILL work. I need a drink. (and I don't drink!!)

                    I have no further comment, I have no idea what to say. I am going to sit her in baffled silence and see if I can make this work on the actual site now.

                    Thanks again.
                    • 7. Re: Passing querystring variable using activex bypass scripts
                      Level 7
                      > I have no further comment, I have no idea what to say. I
                      > am going to sit her in baffled silence and see if I can make
                      > this work on the actual site now.

                      haha Hey, man, sometimes things really don't make sense. That's when
                      you duck and run. The most important thing is that it's working now, so
                      here's hoping for the best!


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


                      • 8. Re: Passing querystring variable using activex bypass scripts
                        digitellinc
                        Alright, I think I know what your trying to accomplish here and I think I have a solution for you.

                        First thing to do, open up AC_RunActiveContent.js, and go to line 30.

                        function AC_FL_RunContent(){
                        var ret =
                        AC_GetArgs
                        ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
                        , "application/x-shockwave-flash"
                        );
                        AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
                        }

                        In this code replace ".swf" with "", save and your good.

                        Open up your HTML doc.

                        Find the below code.

                        AC_FL_RunContent(
                        'codebase', ' http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
                        'width', '800',
                        'height', '600',
                        'src', 'player',
                        'quality', 'high',
                        'pluginspage', ' http://www.macromedia.com/go/getflashplayer',
                        'align', 'middle',
                        'play', 'true',
                        'loop', 'true',
                        'scale', 'showall',
                        'wmode', 'window',
                        'devicefont', 'false',
                        'id', 'player',
                        'bgcolor', '#000000',
                        'name', 'player',
                        'menu', 'true',
                        'allowScriptAccess','sameDomain',
                        'movie', 'player',
                        'salign', ''
                        ); //end AC code

                        Replace 'src', 'player', with 'src', 'player.swf?ctPos=150'.

                        Since you are using php this should be easy to accomplish, with something like 'src', '<?php echo "player.swf?ctPos=" . $_GET[ctPos]; ?>'

                        In your .swf all you need to do is grab this variable which you can do with something like var ctPosNew = ctPos; // you don't need to redefine this variable but I always do.
                        • 9. Re: Passing querystring variable using activex bypass scripts
                          _postdBy(Vern); Level 1
                          For anyone that stubbles across this thread and wonders what happened here, I think I figured it out. I commited a cardinal sin when it comes to coding. To place the swfobject.js file on the server, I did a "copy and paste" orginally. I was in a hurry. During my troubleshooting process, I did replace it by transferring over the original. But I am thinking it was still cashed in the browser and took a few F5's to cycle out and load the NEW version.

                          I really think that was the issue. So I was in a hurry and cost myself a day worth of agrivation over a 5 second deal. Lesson learned .... again!! :)