A continuance on the topic.

 

>From the Flex reference: "All keyboard and mouse activity that is not
expressly trapped is seen by the SystemManager, making it a good place to
monitor activity should you need to do so." .and "The stage is the root of
the display list for the window."

 

So - in reality. your implementation may determine which is better to use.
But I do have something for you that might help. If you are having problems
with the capture/bubbling/target phases you probably need to add two
listeners as.

 

Stage.addEventListener( KeyboardEvent.KEY_DOWN, handleKeyDn, true );

Stage.addEventListener( KeyboardEvent.KEY_DOWN, handleKeyDn, false );

 

This will ensure that you are truly listening for events in all three
phases. Sorry for the earlier post - I didn't read the chain thoroughly and
thought you were trying to do something else (face turns red). 

 

Rick Winscot

 

 

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Sherif Abdou
Sent: Tuesday, March 04, 2008 2:43 PM
To: [email protected]
Subject: Re: [flexcoders] Global keyboard capture?

 

For Flex, use systemManager instead of stage from what i was told and the
capture. no idea on combo sorry

----- Original Message ----
From: thirtyfivemph <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, March 4, 2008 1:32:58 PM
Subject: [flexcoders] Global keyboard capture?

I'm wanting to globally capture the keyboard in my Flex app. I want to
be notified of every keyboard event that happens as long as the Flash
Player has the focus... regardless of whether the event happens when a
UIComponent has keyboard focus or not.

Here's what I'm doing:

stage.addEventListe ner(KeyboardEven t.KEY_DOWN, handleKeyboard, false,
int.MAX_VALUE) ;
stage.addEventListe ner(KeyboardEven t.KEY_UP, handleKeyboard, false,
int.MAX_VALUE) ;
stage.addEventListe ner(KeyboardEven t.KEY_DOWN, handleKeyboard, true,
int.MAX_VALUE) ;
stage.addEventListe ner(KeyboardEven t.KEY_UP, handleKeyboard, true,
int.MAX_VALUE) ;

Since the stage is at the top of the display list, and since I'm
listening for events in both the capture and bubble phase, and since I
have the highest possible event priority, should I see all keyboard
events?

The problem is that I'm not... I've got a situation in my app where I
start seeing only keyDown events with no matching keyUp events. It
happens after I click on a ComboBox drop-down in a popup, then the
popup is closed. At that point, I only get keyDown events until I
click on another UI component.

Any ideas what could be happening here?

In general, is there a way I can guarantee that I can direct *all*
keyboard events to a given function?

Thanks,

Troy.

 

 

  _____  

Never miss a thing. Make Yahoo
<http://us.rd.yahoo.com/evt=51438/*http:/www.yahoo.com/r/hs>  your homepage.


 

<<image001.jpg>>

<<image002.jpg>>

Reply via email to