  | | | Event Dispatcher between classes | Event Dispatcher between classes 2004-03-16 - By Pranav Verma
Back u r just missing one thing.... your dispatcher classs shud extend UIComponent! so it will be like this
import mx.core.UIComponent class focuscast.core.Databaseproxy extends mx.core.UIComponent{
thats it.
You dont even need to import EventDispatcher class or initialze it (EventDispatcher.initialize(this)) they all come free ;) with UIComponent class... so just extend UIComponent and u r all set:)
Pranav.
> -- --Original Message-- -- > From: Jens L?ffler [mailto:jensloeffler@(protected)] > Sent: Tuesday, March 16, 2004 3:12 AM > To: flashcoders@(protected) > Subject: Re: [Flashcoders] Event Dispatcher between classes > > > Yes, I think that's within my framework. But I haven't > figured out how to > connect two classes using the event modell. > > This is my example: > How can I make it work? > > Sender: > > import mx.events.EventDispatcher; > class focuscast.core.Databaseproxy { > public function Databaseproxy() { > EventDispatcher.initialize(this); > } > public function loadClients():Array { > var clientarray:Array = new Array(); > clientdata = new LoadVars(); > > clientdata.load("http://internal/database.php?action=loadClients"); > clientdata.onLoad = clientdata_loaded; > return clientarray; > } > public function clientdata_loaded() { > trace("dispatching"); > var responseobj:Object = {}; > responseobj.type="onUpdateClient"; > responseobj.target=this; > responseobj.data=clientarray; > dispatchEvent(responseobj); > } > } > > > > Receiver: > > class focuscast.core.Datahandler extends MovieClip { > public var databaseproxy; > function Datahandler() { > databaseproxy = new Databaseproxy(); > > databaseproxy.addEventListener("onUpdateClient", this); > } > > function onUpdateClient() { > trace("received"); > } > } > > > >From: "Erik Bianchi" <erikbianchi@(protected)> > >Reply-To: flashcoders@(protected) > >To: <flashcoders@(protected)> > >Subject: Re: [Flashcoders] Event Dispatcher between classes > >Date: Mon, 15 Mar 2004 16:18:19 -0500 > > > >Take a look at using the MVP design pattern. Sounds like you > just need to > >work on your architecture a bit and this pattern will help > resolve this for > >you. > > > >Basically a Presenter would be responsible for initializing your > >components/classes and hooking them together. When using MVP that > >relationship would be hooking the model and view together. > The Model being > >the broadcaster(subject) and the view listening to the > broadcast(observer). > > > >hope that helps. > > > >-erik > >-- -- Original Message -- -- > >From: "Jens L?ffler" <jensloeffler@(protected)> > >To: <flashcoders@(protected)> > >Sent: Monday, March 15, 2004 4:01 PM > >Subject: [Flashcoders] Event Dispatcher between classes > > > > > > > Hi, > > > > > > does anyone know what's the best way to use the Event > Dispatcher between > >two > > > classes to send messages? I've initalized the sending class in the > > > constructor with eventdispacher, and extended the > listening class to a > > > movieclip, so a public function can be used to receive > the message, but > >it's > > > doesn't really work. Is there any standard way? (I don't > want to use > >code > > > outside the classes) > > > > > > Jens > > > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ > > > Sch?tzen Sie Ihren Posteingang vor unerw?nschten E-Mails. > > > http://www.msn.de/antispam/prevention/junkmailfilter Jetzt > > > Hotmail-Junk-Filter aktivieren! > > > > > > > > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > -- ------ > > > Supported by Fig Leaf Software > > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > -- ------ > > > Be sure to check the archives and the wiki: > > > http://chattyfig.figleaf.com/ > > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > -- ------ > > > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107037 > > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > -- ------ > > > To unsubscribe send a blank e-mail to: > > > Normal Mode: flashcoders-unsubscribe@(protected) > > > Digest Mode: flashcoders-digest-unsubscrive@(protected) > > > > > >=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > -- ---- -- > >Supported by Fig Leaf Software > >=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > -- ---- -- > >Be sure to check the archives and the wiki: > > http://chattyfig.figleaf.com/ > >=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > -- ---- -- > >http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107040 > >=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > -- ---- -- > >To unsubscribe send a blank e-mail to: > >Normal Mode: flashcoders-unsubscribe@(protected) > >Digest Mode: flashcoders-digest-unsubscrive@(protected) > > > > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ > Schlu? mit Spam! > http://www.msn.de/antispam/prevention/junkmailfilter Wir > helfen Ihnen, unerw?nschte E-Mails zu reduzieren. > > > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > -- ------ > Supported by Fig Leaf Software > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > -- ------ > Be sure to check the archives and the wiki: > http://chattyfig.figleaf.com/ > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > -- ------ > http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107042 > =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > -- ------ > To unsubscribe send a blank e-mail to: > Normal Mode: flashcoders-unsubscribe@(protected) > Digest Mode: flashcoders-digest-unsubscrive@(protected) >
**************************************************************************** This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us @ http://www.masconit.com ****************************************************************************
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107067 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |