Using flash vars – part 2

In the previous post, we talked about ways to pass flash vars to our flex application.
In this post, we’ll discuss how to read, analyze and use them in our flex application.

Actually, it’s really quite simple.

First, let’s create a FlashVarsManager utility class that will be responsible for loading, parsing and serving flash vars. Basically, it’s a Singleton class with a parse method and getters.
Check out one implementation here (use right-click -> save as).

In your main application file (the one that has the Application tag), add a listener for the application’s creationComplete event, and in the handler put this line of code:

From that point on, you can get to the flash vars values using the FlashVarsManager getters.


One Response to Using flash vars – part 2

  1. […] the next part, we’ll discuss how to analyze the flash vars in the Flex […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: