There are several ways to do this. I usually use javascript in the html
wrapper to split the url params in to an array:
var _sPassedUrlParms = new String(document.location).split('?')[1]; //Get
any passed-in querystring parms
then, I pass that into the Flex app using flashvars:
AC_FL_RunContent(
"src", "${swf}",
.
"flashvars", _sPassedUrlParms,
.
Then I access those flashvar values in Flex using
application.application.parameters object, which will have a property:value
for each passed in url param.
You can also use ExternalInterface to get the URL information instead of
using the javascript, google for examples of that. I found this component
that seems to encapsulate that functionality:
http://www.flexpasta.com/index.php/2008/03/15/getting-url-parameters-host-na
me-port-in-flex-actionscript/
Tracy Spratt,
Lariat Services, development services available
_____
From: [email protected] [mailto:[email protected]] On
Behalf Of Penny Laus
Sent: Saturday, January 23, 2010 10:41 PM
To: [email protected]
Subject: [SPAM] [flexcoders] Reading URL arguments from within initApp()
I'm working on a registration system that will be used by new and
existing participants. The customer would like to be able to email
existing participants a URL that bypasses the login screen. So, if the
usual URL is
http://www.foo. <http://www.foo.com/register.html> com/register.html
They would like to use a URL that skips the landing screen and goes
right to the registration details (name, address, etc.):
http://www.foo. <http://www.foo.com/register.html?user=bob&password=pluto>
com/register.html?user=bob&password=pluto
(Those aren't the exact arguments but should illustrate the point.)
I've been hunting around but haven't sorted out where to find the
correct properties. If I can read in the URL, I can pass the data to
my existing login function and carry on from there. If there's a more
standard/best-practice way of starting the app with URL arguments, I'm
all ears. Would someone be so kind as to point me in the right
direction? Chances are, I just haven't figured out the right name for
the feature I'm after.
Thanks!!!