Flex reading Querystring Parameters

I didn’t invent this – but had a hard time finding all the pieces, so I’m regugitating it for whomever stumbles across it.

To get the query string parameters from a simple flex project do this:

1. In your html-template/index.template.html file add this line in the first <script> section

var myvars = new String(document.location).split(‘?’)[1];

2.  in the 2nd AC_FL_RunContent() section, the one in the hasRequestedVersion block – change the flashvars line to this:

 “flashvars”,’historyUrl=history.htm%3F&lconid=’ + lc_id + ‘&’ + myvars,

3. In your application mxml file reference the values directly through the core level parameters object like this:

var queryValue = Application.application.parameters.parameterName;

Like I said, this isn’t something I figured out on my own – but looking for the answer I found many ways to pass data to embedded swfs etc… but not a simple answer to my question.



One thought on “Flex reading Querystring Parameters

  1. Hi,

    I tried as per your above steps.

    But it is giving me error “variable undefined” when i am putting parameter name in mxml file.

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s