
Код AS3:
public class SeparatorComboBox extends ComboBox
{
private var _disabledFunction:Function;
public function SeparatorComboBox()
{
super();
itemRenderer = new ClassFactory(SeparatorComboBoxItemRenderer);
dropdownFactory = new ClassFactory(SeparatorList);
addEventListener(DropdownEvent.OPEN, openListener);
addEventListener(ListEvent.CHANGE, change);
}
private function change(event:ListEvent) : void
{
if (this.textInput.getTextField().truncateToFit())
{
this.toolTip = this.text;
} else
{
this.toolTip = null;
}
}
public function set disabledFunction(value:Function):void
{
_disabledFunction = value;
}
public function get disabledFunction():Function
{
return _disabledFunction;
}
private function openListener(event:DropdownEvent):void
{
var list:SeparatorList = dropdown as SeparatorList;
if (list != null)
list.disabledFunction = _disabledFunction;
}
}