Read the Flex 3 docs about Dispatching Custom events.
To dispatch an event from such a component:
dispatchEvent( new Event( "eventName" ) );
To add a listener for the event:
dispatcher.addEventListener( "eventName", eventHandlerFunction );
Let me know if that helps...
My english isn't so good, so please correct me if I'm wrong:
Currently, I have application in which I have 2 components, let's name it Comp1 and Comp2 (containing several standard controls like text input, label, combobox etc.) and 1 module loaded (let's name it Mod1) dynamically into one of that component (Comp2). In this module I have another component -> Comp3, with combobox. When I change the value of this combobox, I connect to mySQL database, get the data and ... I would like to change a several controls in Comp1.
First of all, I should create a components Comp1, Comp2 and Comp3 which implements IEventDispatcher.
In Comp3 I have the data from my database, and there I should dispatch event and place my data in event object.
In Comp1 I should add listener for this event using addEventListener()
Am I right?
1 person found this helpful
Yes, it sounds like you are on the right track. Mod1/Comp3 will dispatch events and Comp1/Comp2 will listen for them with addEventListener().