Encapsulation is a good thing. The events themselves should hold all the
data you need about the action as Ben said above. If you create new custom
events you should make sure they have storage for all the properties any
listener would need to know about what triggered the event, etc. If there's
really something you need that isn't in the event you can make it a class
variable and have access to it from the handler, stuff like state variables
is a good example since you may be in a state where you don't need to take
any action.

On Wed, Apr 16, 2008 at 3:46 PM, ben.clinkinbeard <
[EMAIL PROTECTED]> wrote:

>   You probably don't need to send extra parameters anyways. You can
> inspect the event.target your handler receives to determine which
> button was clicked. (I am guessing that may be your intent in sending
> extra args as I remember doing stuff like that back in the AS1 days.)
> Suffice to say that any forking/special handling can/should be done in
> the handler rather than the initiator.
>
> HTH,
> Ben
>
>
> --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "Alex
> Harui" <[EMAIL PROTECTED]> wrote:
> >
> > You can call it anything you want. I call it strongly-typed languages
> > and a good event model, and they prevent me from having mysterious
> > hard-to-find errors because I mistyped a variable name, and allow me to
> > hook up more than one handler to the event.
> >
> >
> >
> > ________________________________
> >
> > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> [mailto:
> flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>] On
> > Behalf Of Jason The Saj
> > Sent: Wednesday, April 16, 2008 11:54 AM
> > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Re: addEventListener and additional arguments?
> >
> >
> >
> > Okay then....
> >
> > How do I do the simple act of "click" event call function and pass a
> > parameter value?
> >
> > This was easy in AS1/AS2/JS
> >
> > I could essentially just say...
> >
> > btnFoo.release = function (parameters){...}
> >
> > Now, it looks like i need to add an event listener. Then create a
> > custom event. All so I can pass a number to a function call.
> >
> > Um...can we say asinine?
> >
> > ***
> >
> > Please, some one show me a nice easy way.
> >
>
>  
>

Reply via email to