RE: [flexcoders] Application.application.parameters doesn't hold GET query parameters

2008-12-15 Thread Tracy Spratt
Yes, as nate says.  Remember, you are callling an *html* file.  Html is
dumb unless you code in javascript.  Here are some snippets that you can
add to the html wrapper that pass querystring parameers into Flex.

First, declare a variable to hold the params:
var _sPassedUrlParms = new String(document.location).split('?')[1];
//Get any passed-in querystring parms
 Then, pass that into the Flex app:
  AC_FL_RunContent(
  "src", "Coalesce",
  ...
  "flashvars", _sPassedUrlParms, 
  ..."
  );



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Nate Beck
Sent: Monday, December 15, 2008 12:06 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Application.application.parameters doesn't
hold GET query parameters

I don't believe Flash natively reads URL parameters from the browsers
query string.  

However, here are a few ways you can do it:
*   Write a javascript (or serverside) method that takes the
browsers query string and the passes them in as flashvars.
*   You CAN add a query string directly to the embed code, (ex
UrlParams.swf?foo=bar), Those will be treated as flashvars as well.
*   If you have javascript access on the page, add an
ExternalInterface call which will return the query string to your swf.
Hope that helps,
Nate

On Mon, Dec 15, 2008 at 8:53 AM, ozziegt  wrote:
I feel kind of stupid asking this, but I have been beating my head
against the wall and I know I am missing something obvious.

I created a sample app here (you can view source on it):
http://osmanu.com/flex/UrlParams/UrlParams.html?foo=bar

You will notice there are no URL parameters being reported by the
application. The code is pretty basic, so I don't know what I am
missing. This is a brand new sample app...I created it, added a few
lines of code, and that is it. Any ideas? 

Thanks

private function showParams():void
{
var params:Object = Application.application.parameters;
var s:String = "Params: \n";
params.runtime = "added in code";
for (var key:String in params)
{
s += key +":" + params[key] + "\n";
}
txt.text = s;
}

 


Re: [flexcoders] Application.application.parameters doesn't hold GET query parameters

2008-12-15 Thread Nate Beck
I don't believe Flash natively reads URL parameters from the browsers query
string.
However, here are a few ways you can do it:

   - Write a javascript (or serverside) method that takes the browsers query
   string and the passes them in as flashvars.
   - You CAN add a query string directly to the embed code, (ex
   UrlParams.swf?foo=bar), Those will be treated as flashvars as well.
   - If you have javascript access on the page, add an ExternalInterface
   call which will return the query string to your swf.

Hope that helps,
Nate

On Mon, Dec 15, 2008 at 8:53 AM, ozziegt  wrote:

>   I feel kind of stupid asking this, but I have been beating my head
> against the wall and I know I am missing something obvious.
>
> I created a sample app here (you can view source on it):
> http://osmanu.com/flex/UrlParams/UrlParams.html?foo=bar
>
> You will notice there are no URL parameters being reported by the
> application. The code is pretty basic, so I don't know what I am
> missing. This is a brand new sample app...I created it, added a few
> lines of code, and that is it. Any ideas?
>
> Thanks
>
> private function showParams():void
> {
> var params:Object = Application.application.parameters;
> var s:String = "Params: \n";
> params.runtime = "added in code";
> for (var key:String in params)
> {
> s += key +":" + params[key] + "\n";
> }
> txt.text = s;
> }
>
>  
>