Yeah that totally makes sense and looks like the proper way of doing things.
Thanks Muzak -b --- In [email protected], "Muzak" <[EMAIL PROTECTED]> wrote: > > I think what you're looking for is a Singleton class that extends EventDispatcher which only purpose is to be able to add listeners > to and dispatch events upon. > > package com.muzakdeezign.mvc.managers { > import flash.events.EventDispatcher; > public class SystemEventManager extends EventDispatcher { > > private static var __instance:SystemEventManager = null; > > public function SystemEventManager() { > if(__instance != null) { > throw new Error("Instance of SystemManager already exists. Use SystemManager.getInstance()"); > } > } > > public static function getInstance():SystemEventManager { > if(__instance == null ) { > __instance = new SystemEventManager(); > } > return __instance; > } > } > } > > //from anywhere in your app: > > import com.muzakdeezign.mvc.managers.SystemEventManager; > > SystemEventManager.getInstance().addEventListener("someEvent", someEventHandler); > > //and somewhere else in your app > SystemEventManager.getInstance().dispatchEvent(new Event("someEvent")); > > Make sense? > > regards, > Muzak > > ----- Original Message ----- > From: "bithroop" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Thursday, November 29, 2007 5:33 PM > Subject: [flexcoders] Re: Events and Non-Display Objects > > > Jehanzeb - first, thank you for the detailed response! I really > appreciate it. > > In the code you provided, the CustomEventDispatcher was instantiated > within the mx:Application object. So from what I've seen, yes > Application will be able to hear CustomEventDispatcher's events. > > However, my sitation is more like: > > Application > | > |------>ContainerC->ContainerD > | > |------>ContainerA->Custom AS class not in display > list->CustomEventDispatcher. > > And I want CustomEventDispatcher's event to be heard by Container D. > Right now I have my listener on Application, and then Application is > calling a method on ContainerC, which is then calling a method on > ContainerD. This seems to be ugly and bad form. >

