RIA Developer, Flex / Flash, Widgets
Posts tagged ComboBox
Tip of the Day – How to create a prompt field on your mx:ComboBox
Apr 18th
For a long time I’ve been doing things like this within Flex.
[Bindable] private var _skills:Array = [ {label: "---", id: -1}, {label: "1 - Newbie", id: 1}, {label: "2 - Some Experience", id: 2}, {label: "3 - Expert", id: 3}, {label: "4 - I'm a baller", id: 4} ];
And then binding this data provider to a ComboBox…
<mx:ComboBox id="skillsCB" dataProvider="{_skills}" />Well it turns out there is a much easier way of doing this that I never knew of until today. ComboBox has a “prompt” attribute that you can set. It’s so easy…
<mx:ComboBox id="skillsCB" dataProvider="{_skills}" prompt="---" />I told you it was easy. Can’t believe I never noticed it before.