Flex 2.0.1
We are dynamically generating/building a form and putting it in a
"content area". The form has a list of fields that are custom fields
(wrappers for the real UI component). I'm trying to capture a key
press in the content area. It works for the "TextInput" custom
component, but not the ComboBox. Any Ideas? Here's the basic class
structure (pseudo-code):
-----------------------
class BaseControl extends UIComponent {
protected var component : UIComponent;
}
class MyComboBox extends BaseControl {
public MyComboBox () : void {
component = new ComboBox();
}
}
class MyTextInput extends BaseControl {
public MyTextInput () : void {
component = new TextInput();
}
}
class MyForm extends UIComponent {
var fields : ArrayCollection; // list of BaseControls
}
Content.mxml:
<script>
var form = new MyForm();
... add form fields
content.addChild(form);
content.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyboard);
private function handleKeyboard(event:KeyboardEvent) {
Alert.show("Key down");
}
</script>
<mx:VBox id="content">
</mx:VBox>
--------------------
The problem is that the keyboard handler is being called correctly
when a key is pressed with the cursor in the custom Text input field,
but is not getting called when the custom ComboBox has focus and a key
is pressed.
What am I missing?