Thursday, June 26, 2008

Of things that bind

Bindables, bindables...

I wanted to take the next step with using code behind and tried to bind a combobox to dynamically loaded list in the code.

although i'm quite uncertain that this is indeed the only way to do it, what i managed to be doing is the following:

added to the MXML <mx:ComboBox id="cboOptions" dataProvider="{items}" />

then in my binded application class added:
[Bindable] public var cboOptions:ComboBox;
[Bindable] public var items: Array = new Array();

and in the constructor added:
items.push('nimrod');
items.push('shelly');

it works, nothing more nothing less...

one more thing i found out about flash/flex during the process:
It doesn't like me defining my class as extends canvas as i saw in an example, and yields "no resource manager".
apparently, extending Application is the correct way to start it without getting this error.
couldn't find any documentation that will elaborate on that.

bye.

No comments:

Post a Comment