Reading FlashVars in Flex
To read the value of a FlashVar(s) use the following in your creationComplete handler.
1 | _myNumber = Application.application.parameters.myNumber; |
And the Javascript snippet would look like this if you using the default AC_FL_RunContent method.
1 | "FlashVars", "myNumber=123", |
Or for multiple variables:
1 | "FlashVars", "myNumber=124&myString=polyGeek", |
And if you’re using SWFObject then the Javascript would look something like this:
1 2 3 4 | <script type="text/javascript"> var flashvars = { myNumber: "123.456", myString: "polyGeek" }; |
1 2 3 4 5 6 7 8 | swfobject.embedSWF( '${application}.swf', '${application}_div', '${width}', '${height}', '9.0.45', 'expressinstall.swf', flashvars, {bgcolor: '#ffffff', menu: 'false'}, {id: '${application}'}); </script> |
More info about SWFObject at GoogleCode.
If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.





