2 Replies Latest reply on Jul 16, 2009 6:05 AM by megharajdeepak

    How to use URL parameters in Flex?

    megharajdeepak Level 1

      Hello Everyone,

       


      I wanted to know how can the parameters passed in a URL be used in our Flex application. I searched in the forum and tried these links:

       

      http://forums.adobe.com/message/217950#217950

       

      http://www.danvega.org/blog/index.cfm/2009/2/5/Flex-FlashVars-in-local-development

       


      In the second link, this is the solution provided:

       

         1. // if we've detected an acceptable version
         2. // embed the Flash Content SWF when all tests are passed
         3. AC_FL_RunContent(
         4.         "src", "ffManager",
         5.         "width", "100%",
         6.         "height", "100%",
         7.         "align", "middle",
         8.         "id", "ffManager",
         9.         "quality", "high",
        10.         "bgcolor", "#869ca7",
        11.         "name", "FFManager",
        12.         "allowScriptAccess","sameDomain",
        13.         "type", "application/x-shockwave-flash",
        14.         "pluginspage", "http://www.adobe.com/go/getflashplayer",
        15.         "flashvars","username=dvega"
        16. );

       


      private function init():void {
          
          // grab the username so we can track who is logged in
         
          [Bindable] private var:username= Application.application.parameters.username;
      }

       

      But here, I am getting the hardcoded value (ie.,dvega) as the data inside my flex application. Instead I would need the dynamic data that is passed through the URL. For Ex: if I use the URL, http://172.22.41.154/MH_2.html?myName=Arush

      I need would need to use the name 'Arush' inside the application. Can you please help me on how and what part of the code is to be modified?

       

      Thank you,

      Warm regards,

      Deepak