4 Replies Latest reply on Dec 5, 2008 7:49 AM by Ansury

    Flex Session Handling

    MBhatt
      Hoe to acess the the session variable in actionscript?
        • 1. Re: Flex Session Handling
          John Hall Level 4
          Might need to clarify a bit. Are you talking about a session variable that lives on the server and you want to populate your actionscript (swf) file with that value at startup? Not quite sure what you're asking.
          • 2. Re: Flex Session Handling
            MBhatt Level 1
            Yes..You are right.
            Session variables that lives on the server is accessible in this way in .java file -

            FlexSession flexSession = FlexContext.getFlexSession();

            String username = flexSession.getAttribute("userName").toString();

            But , what if I want to access this session variable in my actionscript file.

            I tried to import flex.messaging.FlexSession in .as file but it does not allow me to do so.
            • 3. Re: Flex Session Handling
              *gsb* Level 1
              You can use php to set a FlashVar in the html wrapper that is passed into the swf I would think. ...although this seems not to be such a good idea I would think.

              • 4. Re: Flex Session Handling
                Ansury Level 3
                You can't do that like a traditional web application. Best Java solution? Use AMF - google Flex remoting with Java using BlazeDS, Granite Data Services, or LCDS if you don't know what it is. Just do a regular remoting call to the server to get whatever variable you want, AFAIK there's no other way.