could be renamed in a future release to something like "mouseClick" and
then your code wouldn't work.
Or even worse, you write "cllck", and then for days even months, you think your app isn't working or 'works' a certain way. Come to find out the event wasn't even getting captured. :) This is plain ole preventative maintainence. That is the worse case for me, renaming events is small potatoes to that error. ;-) Peace, Mike On 2/7/07, Doug McCune <[EMAIL PROTECTED]> wrote:
Nope, I think the second parameter must be a function, trying to pass an array of functions should fail. Also, just a note: it's better practice to not use the string of the event listener like "click" but rather the variable like MouseEvent.CLICK. They really do the exact same thing in practice, but it's possible that within MouseEvent the click event could be renamed in a future release to something like "mouseClick" and then your code wouldn't work. Doug Mike Anderson 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]> <[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'.