3 Replies Latest reply on Jul 16, 2009 8:38 PM by Madhav Subedi

    Passing parameters to swf

    Mohd Fayaz Level 1

      I am developing an application which has a login page ( in a separate swf file). If authentication succeed I have to display another swf files. However, I need to pass some parameters between these two files (like sessionToken, username etc).

       

      I am using navigateToURL method to call the second swf file. I am able to pass the argument by appending it to url. However, I dont want to show these parameters on URL. When I use Post method and pass parameters using data property of URLRequest, the second swf is not showing up in browser.

       

      Can anyone please help me with this problem?

        • 1. Re: Passing parameters to swf
          Madhav Subedi Level 4

          you can pass parameters through flashvars attribute of embed tag( in your wraper.)

          which can be accessed in flex using:

           

          Application.application.parameters;

           

          this will work if you post the parameter value to second page( wrapper ) and provide the parameter to second swf through the embed tag of second wrapper.

           

          example:

           

          embedding tag:

          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

          id="audioMPmini" width="100%" height="100%"

          codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">

          <param name="movie" value="my.swf" />

          <param name="quality" value="high" />

          <param name="bgcolor" value="#869ca7" />

          <param name="allowScriptAccess" value="sameDomain" />

          <embed src="my.swf" quality="high" bgcolor="#869ca7" flashvars="my_param=myfile.ext"

          width="100%" height="100%" name="my" align="middle"

          play="true"

          loop="false"

          quality="high"

          allowScriptAccess="sameDomain"

          type="application/x-shockwave-flash"

          pluginspage="http://www.adobe.com/go/getflashplayer">

          </embed>

          </object>

           

          flex code to access my_param parameter:

          param = Application.application.parameters.my_param;

          • 2. Re: Passing parameters to swf
            Mohd Fayaz Level 1

            How to write into the wrapper from first swf file.???????

            • 3. Re: Passing parameters to swf
              Madhav Subedi Level 4

              things seem little bit complicated as you dont want to show the parameters in the URL and you are using navigateToURL.

               

              is it possible for you to POST the parameters from first wrapper, not from flex ( using ExternalInterface ), and catch the POST variables in the second Wrapper, so that you can pass the parameters in the EMBED tag?