This content has been marked as final. Show 3 replies
I am not sure why you need to instantiated the component twice. A component can broadcast several different events of the same Type. For an example:
broadcaster.broadcastEvent(WidgetEvent.ENTER, new WidgetEvent(widgetVo));
broadcaster.broadcastEvent(WidgetEvent.UPDATE, new WidgetEvent(widgetVo));
Are you sure the component doesn't broadcastEvent 2 calls for a each click? Perhaps one is being fired off in a subclass and the other in the super class?
"...but because the command expects a Cairngorm event of a certain type..."
The command expects a Event Type. Cairngorm will deserialize your custom event into a Event type with the following properties:
public var type:String;
public var data:Object;
So the data will property will hold your custom Event. And you would set that as an instance var in the command.
It's not that odd to use the same component twice in different. For example, have you ever used more than one VBox or Form or ViewStack or Canvas in an app? Or on the less visual side, how about ArrayCollections or XML?
w/o seeing code, I can't say whether or not the problem is due to the component being instantiated twice. I think it is unlikely that just having two instances would cause two remote calls. I'd look for something inside the component that is causing the second call.
I agree with the examples you have posted JeffHouser. But I was under the assumption that the component (one instance) serves 2 purposes; one for 'entering' new data and the other for 'updating' existing data.