Flash Builder / Flex 4 and Flash vars.

I don’t know if this has changed since Flex 3, but I couldn’t find any information about how to access Flash vars from within a Flex 4 application. Since the beta was only recently released it’s no surprise that documentation is lacking. One thing that I couldn’t find was how to access flash vars passed via HTML from within a Flex 4 application.

In Flex 3 I used this:

[Bindable]
protected var someparam:String;

protected function applicationCompleteHandler(event:FlexEvent):void {
     this.someparam = Applcation.application.parameters.someparam;
}

In Flex 4 it’s a little more intuitive, but not documented (at least not where I could find it).

In Flex 4 do this to grab the flash vars:

[Bindable]
protected var someparam:String;

protected function applicationCompleteHandler(event:FlexEvent):void {
     this.someparam = this.parameters.someparam;
}

Pretty simple, but elusive.

about me

An information technology professional with twenty one year's experience in systems administration, computer programming, requirements gathering, customer service, and technical support.