This content has been marked as final. Show 4 replies
"projectproofing" <email@example.com> wrote in message
> Coming from a CF background, I have always been able to set my user's
> username in a variable scope that the entire application could reference
> (session). I know that in Flex/Flash there is no sessions since Flex is a
> persistent application.
> How do you set a global variable that can be used by the main application,
> component, and modules to help thin out data?
Google the Singleton pattern in Flex.
Just create a public Boolean variable in the main MXML file that is set to true/false depending if they are logged in or not.
You can access the variable from most components using Application.application.myVarName
Don't forget to import mx.core.Application in your components.
Sometimes you might use parentApplication.myVarName or parentDocument.myVarName.