I have a custom component made up of a selectable control (radio button) and a text input. I want to perform some logic in response to the change events from both of those controls, but after that I want anything that is registered on the composite component's change handler to have a change to handle the events as well. The problem is, when I re-dispatch the events the event target has changed to my custom component, losing the originating event's target.
Here's my custom component:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" label="{listItem.@text}" data="{[email protected]()}">
<mx:Script>
<![CDATA[
import mx.controls.RadioButtonGroup;
[Bindable]
public var selected: Boolean;
[Bindable]
public var text: String;
[Bindable]
public var listItem: XML;
[Bindable]
public var group: RadioButtonGroup;
private function onSelectionChange(event: Event): void {
selected = event.target.selected;
dispatchEvent(event);
}
private function onTextChange(event: Event): void {
text = event.target.text;
dispatchEvent(event);
}
]]>
</mx:Script>
<mx:RadioButton group="{group}" label="{label}" selected="{selected}" change="onSelectionChange(event)"/>
<mx:TextInput width="100%"
maxChars="{listItem.specify.@entryLength}"
enabled="{selected}"
visible="{listItem.hasOwnProperty('specify')}"
includeInLayout="{visible}"
change="onTextChange(event)"/>
</mx:HBox>
In the event handler that receives change events from this component, I see that event.target is an instance of SpecifyRadioButton, not the TextInput or RadioButton, as I'd expect. How should I propagate the event to get what I want here?
Getting event [Event type="change" bubbles=false cancelable=false eventPhase=2]
from question0.tabSurvey.questionForm.questionContainer.Single94.VBox95.SpecifyRadioButton111