I finally found an answer. Now I wonder if this was what you were saying all
along and I was too focused on adding the event listener rather than
thinking of scope. The down side is that I ended up adding four listeners
to add one that I needed. So here is how I did it.
in the tab or NavigatorContent, I added a click event and then in the click
event, I fired a Metadata Event.
Then in the parent, I created the Metadata event from the definition of the
Child Panel. When that was fired, then I added the color change event which
worked.
Child code
<fx:Metadata>
[Event(name="roofOptionsClicked", type="flash.events.Event")]
</fx:Metadata>
protected function
roofNavigator_clickHandler(event:MouseEvent):void
{
var eventObject:Event = new
Event("roofOptionsClicked");
dispatchEvent(eventObject);
}
<s:NavigatorContent label="Roof" id="roofNavigator"
click="roofNavigator_clickHandler(event)">
<options:RoofOptions id="roofOptions" width="100%"
height="100%"
roofcolors="{colors}"
/>
</s:NavigatorContent>
Parent Code
<options:OptionsView id="optionsView"
width="25%" height="100%"
colors="{colors}"
pitchs="{pitchs}"
roofOptionsClicked="optionsView_roofOptionsClickedHandler(event)"
/>
protected function
optionsView_roofOptionsClickedHandler(event:Event):void
{
optionsView.roofOptions.addEventListener(ChangeRoofColor.CHANGED,
roofOptions_roofColorChangedHandler);
}
protected function
roofOptions_roofColorChangedHandler(event:ChangeRoofColor):void
{
--
View this message in context:
http://apache-flex-users.2333346.n4.nabble.com/EventListener-null-reference-error-tp13436p13462.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.