Hello list,
I've got the classic pixlib MVC architecture.
I've got a command that is called at the init of the application to load some data from a XML. The event, listed in the EventList is called LOAD_XML. In order to perform some user interface changes, I want some views to listen for this event. However, I'm not sure where I should add the views as listeners for the global EventDispatcher. For now, I'm doing this in the main Application's class constructor:
public function Application ( target )
{
(...)
var vBottomBar:ViewBottomBar = new ViewBottomBar(this.bottom_bar_mc);
var vContent:ViewContent = new ViewContent(this.content_mc
);
EventDispatcher.addListener(vBottomBar);
EventDispatcher.addListener(vContent);
EventDispatcher.dispatchEvent( new BasicEvent( EventList.LOAD_XML ) );
And then I implement a onLoadXml in each of the views. It works fine and seems to be a good design. I could also get a reference for each view in the LoadXML command and call the method directly. What do you think?
Marcelo.
_______________________________________________
Pixlib mailing list
Pixlib@...
http://osflash.org/mailman/listinfo/pixlib_osflash.org