I am trying to let the user set the background color of my flex 4 app by setting the colour in the flashvars variable of the calling javascript.
However, I don't seem to be able to access the flashvars at all, the best result I can get (from trace) is undefined.
The javascript looks like:
<script type="text/javascript">
var flashvars = {};
flashvars.firstname = "bob";
var params = {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
bgcolor: "#FF0000"
};
var attributes = {
id:"OvaWidget"
};
swfobject.embedSWF("myApp.swf", "altContent", "100%", "100%", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
And my mxml is
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
[Bindable]
public var firstname:String;
protected function init():void
{
trace(FlexGlobals.topLevelApplication.parameters[firstname]);
}
]]>
</fx:Script>
<s:Label text="Name: "/>
<s:Label text="{firstname}" fontWeight="bold"/>
Any ideas? All help appreciated!