This content has been marked as final. Show 4 replies
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.
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.
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.
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.