Adobe Livedoc (see here) indicates that you can pass flashvars in different ways through the URL or the flashvar object. I am using Flash Player 10 on Mozilla browser and it seems that the current player doesn’t work as explained.
It seems that there is only one way to pass the flash vars when using the template page that Flex builder 3.0 generates. You need to set it in the src under the javascript tag:
AC_FL_RunContent(
"src", "${swf}?myName=Elad",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
You can then easily read it in your Flex application:
var myName:String = mx.core.Application.application.parameters.myName;
I tested all the other options and nothing else seems to work. I also notices some other posts talking about the same issue, such as here:
http://flexblog.faratasystems.com/?m=200610
This issue may be related to the way the swf is deployed, in any case, I couldn’t get the examples from the livedoc to work. Remember to make the changes in the html-template folder so it will generate your template automatically every time you clean your project.
If anyone have more information, feel free to post it here.






















Hi,
if you use the default template javascript part
you add to set your parameters like this:
AC_FL_RunContent(
…
“FlashVars”, “titi=444&url=woo”
}
If you delete the javascript part you have two ways do set parameters.
This code works:
I am not sure if I follow your comment. From my testing I noticed that without the Javascript part you can pass the flashvars through the FlashVars param without a problem, the issue starts with the javascript being thrown in the mix. I am not sure if it’s browser, JS or Flash 10 issue.
Works for me..
Upgrade to Flex builder 3.2, as some fixes have been made in
the templates (AC_OETags.js etc…) to support Flash 10.
hi,
got mixed up with everything
i am new to flex.
when passing params to swf through html, i have done and that works. didnt check it on Moz’ but IE and Avant it works just fine.
now, i have this mxml project, that its output is swf, lets call it first project.
i need to create another flex project (we will call it test project) that will include a list of options, and after the user selected an option it should invoke the first project passing it the selected option.
how do i do that?
from the samples i have found, i need to change the MXML of the first project to have bindable vars?
thanks in advance for your kind help,
tk
I assume that the form is an HTML page. Once the user submit the form you can pass the variables through the URL.
i used swfloader from the test project to load the first project, passing it params. not so complicated as it seemed from all the talks about it.
thanks anyway,
tk
Not sure why you had problems, the flashvars works as expected in the template. You must be doing something wrong.
Hi Elad,
thank you for the tip. I had the exact same problem as you, and the directions in the Adoble Flex 3 Help article “Paasing request data with flahVars properties” didnt’ work me either.
Your way of doing it works though!
-Malena
Hi Malena, I am happy this post helped you.
few more ways to pass values to flex
http://yasob.blogspot.com/2009/05/accessing-http-request-parameter-in.html
Thank you so much Elad,Your post really helped me
Thanks for your post. I had the same issue!
Not working for me. No matter what I do in my wrapper, Flex Builder simply doesn’t know what the Application.application.parameters is. Actually that’s wrong. It compiles. But then when I place a watch on it in my creationComplete() method I always get:
Application.application.parameters =
No such variable: Application
All examples in the docs have that variable existing at that point. Does it have to be set up later than creationComplete() or something?
In Robert, in case you are using Flex 4 than you need to change the syntax to:
mx.core.Application.application.parameters.myName;
To:
FlexGlobals.topLevelApplication.parameters.myName;
Hi,
Nice post. Thanks for sharing such nice information. Keep it up with good post.
Ravindra
http://www.rsdhariwal.com
Thanks man! This saved me from a lot of headache!
Hi Elad, do you mean that the params have to be hard-coded in the html template page? If so how do I pass params to the Flex application dynamically?
Zihao - you can replace the hard-coded params with middle tier language.