10/7/2010 8:40:00 AM
Title:
Extending PopUpManger.addPopUp to handle data
I would like to extend the PopUpManager.addPopUp method to handle the passing of data(Value Object) to the called component.....
PopUpManager.addPopUp(requestedComponent, this, true, myVOData);
I know there are other ways of passing the data (Global variables, Custom Events), but this would be a clean way of avoiding those. I did try a custom event (one that passes the data with the event) but when I dispatch the event and then call the call the addPopup.... the event (and data) is no where to be found in the component (stopped in the component in debug and looked in Variables view). Not sure whats up with that. I'v had no problems using custom events to pass data from components to main, but going the other direction (main to component) has not been that friendly.
10/9/2010 6:42:18 AM
if you raise a custom event then addPopUp it receive the event . the event needs to be registered before its is raised to receive anywhere. To my opinion using custom events is the most clean way to communicate data , because it provides flexibility and extensibility.
10/11/2010 9:50:46 AM
there are other ways but they are not as clean like using custom events. You can directly access the component and access its public functions to pass data but, in such cases change in the code like changing the name of function needs to be updated to other components also, so not considered a good practice. How ever in small projects you can use this.