2 Replies Latest reply on Feb 21, 2009 8:46 PM by Gregory Lafrance

    Passing variables

    SiHoop Level 1
      I'm working on a project where a swf that I have created will be loaded into another, main, swf. The main swf must pass login variables to my swf, which I think this can be done with the code below. But my question is how do I receive the variables that are being passed to my swf?

      var loader:URLLoader = new URLLoader();
      var request:URLRequest = new URLRequest("Login.swf");
      var variables:URLVariables = new URLVariables();
      variables.classLevel = "1";
      variables.loginID = "Simon";
      request.data = variables;
      request.method = "POST";
      loader.load(request);
        • 1. Re: Passing variables
          SiHoop Level 1
          I think I've found part of the answer to my problem. It seems that I need to pass the variables in an html wrapper embedding something such as:
          flashvars='loginID=1234'
          and then to use something such as the following in Flex to read the variable out of the wrapper:
          var myName:String = Application.application.parameters.loginID
          I want to place some dummy content into the wrapper, but don't know how to do so as the wrapper is automatically generated by Flex when the file is compiled. So how can I place my dummy content into the html wrapper?
          • 2. Re: Passing variables
            Gregory Lafrance Level 6
            Edit index.template.html for the project.