7 Replies Latest reply on Mar 21, 2007 4:57 PM by EliteScientist

    URL query string - easy!

      This must be an easy question, but I'm striking out. I'm trying to get the URL query string used to access my application. The Application object has a url, but it does not contain the query string. It must be stored somewhere as a URLVariables object, but where? I've searched the docs for URLVariables, but the developers' guide only talks about how to set them on a URL, not how to get them from the current URL.

        • 1. Re: URL query string - easy!
          should be located in Application.application.parameters

          or if you're in the Application then just access the variable parameters which is an object..

          access uid=32
          • 2. Re: URL query string - easy!
            bldrbldr Level 1
            That seems reasonable but,

            From the Application object
            for(var prop:String in parameters) {
            trace(prop + "=" + parameters[prop]);
            gives me:

            Neither of which are part of the query string. I've tried in debug mode and just running the application outside of eclipse, and my query string does not seem to be there.

            • 3. Re: URL query string - easy!
              EliteScientist Level 1
              if you're using the html that is generated by Flex Builder you'll have to do some JavaScript to get the variables into the Embed...
              • 4. Re: URL query string - easy!
                bldrbldr Level 1
                Now I'm really lost. I just went through everywhere in the docs (I think) that mentions Embed, and I can only see how that can be used to embed other files in the SWF. I don't see how I can use AS embed tags to get to the Application.parameters object.

                Thanks for your help.
                • 5. Re: URL query string - easy!
                  EliteScientist Level 1
                  first this only applies if you're using the flex generated html file...

                  if so, open up the HTML file.. you'll see a few lines that look like this:

                  "src", "index",
                  "width", "100%",
                  "height", "100%",
                  "align", "middle",
                  "id", "index",
                  "quality", "high",
                  "bgcolor", "#757575",
                  "name", "index",
                  "type", "application/x-shockwave-flash",
                  "pluginspage", " http://www.adobe.com/go/getflashplayer"

                  you'll have add a variable called flashvars, and add the variables there.. you'll probably need the help of PHP to grab the variables off of the url string to append to the (HTML/JS Embed Code)...
                  • 6. Re: URL query string - easy!
                    bldrbldr Level 1
                    Brilliant, it works! Of course, the obvious problem is that everytime I recompile, my flashvars variable gets overwritten. Is there any way to tell the Flex Builder compiler to include the URL query string in the flashvars so I don't have to edit the html files every time it recompiles the app?

                    • 7. Re: URL query string - easy!
                      EliteScientist Level 1
                      in your project folder inside of the Navigator View..

                      look inside of the html-template folder...

                      that is the template that flex builder uses to generate the html file