1 Reply Latest reply on Feb 4, 2010 6:50 AM by amandamartino

    passing data to Flex - flashvars question

    amandamartino Level 1

      Hi,

       

      I have an application that requires me to pass data between ColdFusion 8.0.1 and Flex 4. My application takes the username of the currently logged in user (stored as a ColdFusion session variable) and passes it to Flex, which then passes the username into a CFC to retrieve the user's info to populate a Name/Address form. I've been trying to do this via a cfm wrapper file (instead of HTML) and flashvars, but regardless of what username I pass in, I always get the same user's information returned to the interface, almost as if the value is hard-coded somewhere in my Flex project. I am setting the flashvar value as:

       

      <script type="text/javascript">

                  <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->

                  var swfVersionStr = "10.0.0";

                  <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->

                  var xiSwfUrlStr = "playerProductInstall.swf";

                  var flashvars = {};

                  <cfoutput>

                       flashvars.userName = "#session.userName#";

                  </cfoutput>

      (etc.)

       

      Inside my mxml init() function, I am setting the local flex variable as:

      private function init():void

      {

           var userName:String = this.parameters.userName;

      }

       

      I had originally just hard-coded a value for userName when I was just testing the CF call Flex was making. Oddly, though, after I removed the hard-coded value and tried passing in the userName value from my cfm wrapper (quick note: I've tried passing in this value as both a session and a URL variable and have gotten the same results in both cases), the data returned is still the data associated with the previously hard-coded value. It's as if the Flex project itself is caching that value somewhere and keeps referring to it even though it's changed, but I have no idea if that's the case (or if it's even remotely possible, for that matter) or where I might look for it. I'm very new to Flex, so any help would be greatly appreciated. I've been using this article as a guide: http://www.adobe.com/devnet/flex/articles/fcf_deploying_flash.html; any better or other articles on this topic that might point me in the right direction are also appreciated.

       

      Thanks in advance!

        • 1. Re: passing data to Flex - flashvars question
          amandamartino Level 1

          Also, I've tried removing ColdFusion from the equation entirely and just hard-coding flashvars.userName = "amanda" in an html wrapper and that value still doesn't seem to be getting into Flex, so I think the problem is somewhere in Flex. I had the Adobe example working using Flex 3 but I haven't gotten it to work since I upgraded to Flex 4...is there a difference in the way Flex 3 and 4 handle flashvars that I'm not taking into account?

           

          Thanks!