Nov
4
Arcadio November 4, 2009 5:11 pm

Flex ComboBox extended to implements a select by value feature:

package com.arcadiocarballares {
	import mx.controls.ComboBox;

	public class ComboBoxByValue extends ComboBox {
		private var _selectedValue:int;

	    public function SelectByValueCombo() {
	        super();
	    }

	    public function get selectedValue():int {
	    	return _selectedValue;
	    }

	    public function set selectedValue(value:int):void {
			_selectedValue = value;
			for (var i:String in dataProvider) {
				if (value == dataProvider[i].value) {
					selectedIndex = parseInt(i);
					break;
				}
			}
	    }
	}
}
  • Share/Bookmark

Post a comment



  • Share/Bookmark
Creative Commons License
This blog is under Creative Commons licence, unless indicated otherwise.
Special thanks to Mark James for the icon set used in this blog.