Ahh sorry i see what you mean now.  cool that doesn't mater you continue
dispatching and even adding events the way you are in the class itself but
as a user of the class you would never interact with it directly so in this
case if you had a new connection you wouldn't call directly
addEventListener but instead you would call  EC.add when you want to
trigger an event.

in the back of the hood of the class it will call your built in
addEventLIstener but before doing it it categorizes it and lists it out so
its easier to sort through and monitor events.

that's really the big difference we aren't changing anything in the natural
way events work all we are doing is hijacking the flow to add features and
to monitor memory leaks.

so in your case if you are running a singleton you could do something like
this if you wanted:

public function LoginHandler()

{


EC.add(EventSingleton.dispatcher, "somethingHappen", doSomething,'mygroup');

}



and you wouldn't change anything in the dispatcher itself that can stay the
same.


On Tue, Jul 3, 2012 at 1:59 AM, Devon <devonz...@msn.com> wrote:

> Sorry, I'm may not have been clear... I think I understand what was
> demonstrated in the examples and videos. However, I need to dispatch my own
> custom event dispatchEvent( new Event( "myEvent" ) ); because I'm not
> looking for a click or otherwise automatically dispatched event...
>
> Currently, I'm using a singleton to broadcast events and to listen to
> events on... Given the following example, how can I accomplish the same
> using your class/library?
>
> *Let's say I have:*
> package com.name.connections
> {
>
> import com.name.events.EventSingleton;
>
>
> public class Connection
> {
>
> private var _evt:EventSingleton;
>
>
>
> public function Connection()
>
> {
>
> _evt = EventSingleton.dispatcher;
> _evt.dispatchEvent( new Event( "somethingHappen" ) );
>
> }
>
> }
>
> }
>
> *Then I have:*
> package com.name.handlers
> {
>
> import com.name.events.EventSingleton;
>
>
> public class LoginHandler
>
> {
>
> private var _evt:EventSingleton;
>
>
>
> public function LoginHandler()
>
> {
>
> _evt = EventSingleton.dispatcher;
>
> _evt.addEventListener( "somethingHappen", doSomething );
>
> }
>
> }
>
> }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  --
> --
> http://fla.as/ec
>



-- 
Thanks,

*Ben Fhala*
02Geek.com
HTML5, Javascript, ActionScript & Flash School
follow us on  @02Geek <http://twitter.com/02geek>  ][  Subscribe to
Youtube   <http://www.youtube.com/user/everythingFLA>][ Like us on
FaceBook<http://www.facebook.com/pages/EverythingFLA/163976036972550>

02Geek is part of Everything Nice ,inc creations.

-- 
--
http://fla.as/ec

Reply via email to