Sorry, I don’t know if this works in
the Flex 2 beta, but I should have specified that we’re working with Flex
1.5 at Yahoo. Unfortunately, EventDispatcher states:
function addEventListener(eventType:String,
eventListener):Void
{
// Note: In
the future, we may add a third parameter,
//
useCapture:Boolean, to be compliant with the
// DOM
Level 3 Events spec,
//
http://www.w3.org/TR/DOM-Level-3-Events/events.html.
.
.
.
This would have been very convenient if it were
implemented. Nevertheless, Button and other components do seem able to capture
the event. Is this a question for one of the Flash lists (any recommendation to
which list I should post this question)?
Thanks, Matt – if you or anyone else
has any other ideas, I’d really love to hear them
-Tony
tony pujals| senior engineer | Yahoo! SiteBuilder Express
p. 408.349.6284 | e. tonyp * yahoo-inc . com |
y!id tonypujals
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matt Chotin
Sent: Tuesday, February 14, 2006
9:45 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Mouse
Event Filtering
you want to add your mouse
event listener with useCapture set to true
and then call stopPropagation on the event in your
handler (I think). I
believe that will prevent it from moving further
down the hierarchy.
-----Original Message-----
From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On
Behalf Of Tony Pujals
Sent: Tuesday, February 14, 2006 5:27 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Mouse Event Filtering
There are two variations to my question, but they
should share a common
solution:
1) I want to create a "glass pane" - ie,
a transparent layer that can
capture/consume mouse events without allowing the
event to bubble to a
component below it. I've tried to achieve this
effect with a transparent
Canvas, but the component below it (eg, a
TextArea), also catches the
event.
2) I have a floating toolbar that extends Canvas.
I don't want to use
the PopUpManager because of issues with the
FocusManager and TextArea
that causes text to be selected incorrectly when
focus is returned after
focus was transferred to a toolbar button. If the
toolbar is floating
above the TextArea component, the cursor changes
to an ibeam. If I click
down on the toolbar to drag it, the toolbar drags,
but the TextArea also
gets the events, causing text to become selected.
I want the toolbar to
consume the mouse events occurring on it without
any further event
bubbling.
Since the toolbar has a mouseMove handler that
allows me to drag it, I
can drag even by pressing mouse down on a toolbar
button. I guess the
toolbar as parent is receiving and handling the
mousedown, even though
the mouse down event is also propagating to its
child button component
as well (I actually do not want this behavior
either, but I suppose I
can solve this easily enough with hitTest). But
what is really
interesting is that the event stops there if it's
caught by the button
-- the TextArea below the toolbar doesn't get the
event in this case. So
something about a Button or its superclasses makes
it special, but the
difference isn't apparent to me in the AS source
provided with Flex.
Any insight is appreciated. Thanks!
-Tony
tony pujals| senior engineer | Yahoo! SiteBuilder
Express
p. 408.349.6284 | e. tonyp * yahoo-inc . com |
y!id tonypujals
--
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
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS