Object.addEventListener( "click", [funct1, funct2, funct3] );

No,

1. as3 is strongly typed which means the method expects a function when it
is getting an array.
2. addEventListener wouldn't even know what to do with an array.

You could, if you had your own subclass override addEventListener to do that
but, you could also just create a stack of functions in an array if they
were all going to the same event and loop through them to save code lines.

It's personal choice when you get to this point.

Peace, Mike

On 2/7/07, Mike Anderson <[EMAIL PROTECTED]> wrote:

  Hey Doug,

Well, that's simple enough. Probably so simple, that I simply
overlooked doing it that way.

Real quick, would it be possible to also do it this way?

Object.addEventListener( "click", [funct1, funct2, funct3] );

I know I could just try it, but from a methodology point of view, it
would be nice to know if this was a valid way to do it.

Thanks!

Mike


-----Original Message-----
From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> [mailto:
flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>] On
Behalf Of dougmccune
Sent: Wednesday, February 07, 2007 10:10 AM
To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
Subject: [flexcoders] Re: Object.addEventListener vs.. adding them
inline via MXML

You can make as many calls to addEventListener as you want. So you can
add 2 or more event listeners that get triggered for the same event.

So something like:
myButton.addEventListener(MouseEvent.CLICK, myFunction1);
myButton.addEventListener(MouseEvent.CLICK, myFunction2);
myButton.addEventListener(MouseEvent.CLICK, myFunction3);

All three of the above functions would get called when the event
triggers. You can remove each of these separately as well by using
removeEventListener and specifying the particular function you want
removed.

Doug

--- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "Mike
Anderson" <[EMAIL PROTECTED]> wrote:
>
> Hello All,
>
> I have a problem, and maybe I am overlooking something here...
>
> What I need to do, is attach multiple functions, to an Event for a
> particular Component.
>
> Using inline MXML, this is easy - you just separate out each function,

> with a semi-colon and list them one after another.
>
> BUT, I am trying NOT to put my functions within the MXML - I am using
> Code-Behind, and I need to add my Event Listeners within the
> ActionScript - using the Object.addEventListener() method.
>
> Thing is, how do I add several functions using this type of
methodology?
> Or can it even be done?
>
> Thanks in advance for any help you can offer regarding this,
>
> Mike
>

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links




--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to