> if you subscribe to the event using ActionScript,
> not the mxml handler sugar, then you'll always get the event.
An MXML event attribute like click="trace(event.target)" just autogenerates an
event handler that looks like
function clickHandler(event:MouseEvent):void
{
trace(event.target);
}
The attribute "value" is code that becomes the body of the handler.
Gordon Smith
Adobe Flex SDK Team
From: [email protected] [mailto:[email protected]] On Behalf
Of Mike Chang
Sent: Saturday, April 03, 2010 10:47 AM
To: [email protected]
Subject: Re: [flexcoders] Handler functions convention
Thanks Gabriel.
Mike
2010/4/3 gabriel montagné <[email protected]<mailto:[email protected]>>
On 03/04/2010, Mike Chang <[email protected]<mailto:mikecc%40gmail.com>> wrote:
> I noticed in many examples on the web handler functions mostly have a
> parameter event, even though the event isn't used (such as even.target). I'm
> wondering if there's a reason for this convention.
I'd say it's up to you, but if you subscribe to the event using ActionScript,
not the mxml handler sugar, then you'll always get the event.
> I have to pass a null in case it isn't triggered by the event, which seems
> pretty cumbersome.
Perhaps you could use defaults in the handler, something like
login_clickHandler(event:MouseEvent = null)
Gabriel
--
gabriel montagné láscaris comneno
http://rojored.com
+44 (0) 7500 709 209