Re: [flexcoders] Global keyboard capture?

2008-03-05 Thread Troy Gilbert
 stage.focus = null;
  However, the FocusManager may fight to put the focus somewhere.

Ah, yes... I remember using that as my original attempt to fix this
last year... I put a stage.focus = null in my enterFrame event handler
and the FocusManager continually grabbed it back from me.

  Yeah, I recall that you were adding priority as int.MAX_VALUE. Did you
  try it with default priority? I'm not sure if there are issues using
  MAX_INT as priority.

Yeah, I originally had it with the default priority. I didn't see a
difference by changing the priority.

  Do you have default wmode or are you using some other wmode? Are there
  other focusable widgets in the HTML wrapper?

I'm loading the SWF directly in the browser, no wrapper HTML.

  When you only see keydown and no keyup, is the control with focus
  responding? If you put a target phase listener on that control is it
  reporting the KEY_UP event?

That's the quirky thing... when I see it, I've not longer got a
reference to the control that had the focus (a combo box). I've got a
popup (non-modal) that displays a form of controls (mainly sliders and
combo boxes). I occasionally had the problem that when the popup was
closed (PopUpManager.removePopUp(dialog); dialog = null;) I'd have to
click back onto my application to return the focus to it (no keybaord
events would fire).

But, I've recently added a new derived ComboBox class that displays
images as the item renderer (and has an overriden updateDisplayList to
display the image in place of the textinput). The code I added doesn't
add/remove any event listeners and does nothing keyboard related (just
rendering). And now I get keyDown's but not keyUp's (until I click
back on the app, at which time I get the keyUp's again).

Troy.


Re: [flexcoders] Global keyboard capture?

2008-03-05 Thread Troy Gilbert
 This is why Rick's suggestion of both a capture and non-capture phase
 listener on stage is correct.

Which is what I was doing originally, as per the source code in my first post.

If a display object has the focus, then is removed from the stage,
does it automatically lose the focus (I would think so) even if it
still has event listeners registered?

Troy.


RE: [flexcoders] Global keyboard capture?

2008-03-05 Thread Alex Harui
I hardly ever use KEY_UP so if there's some quirk there, I wouldn't know
about it.

 

In theory, if the object that had focus was in a popup and the popup was
removed, the framework should return focus to the last focused entity in
the main app or some other popup depending on the z-order.  If you've
removed the focused object from the popup prior to removing the entire
popup, I'm not sure who would get focus, but basically the framework is
trying to assign focus to something in most cases.

 

If you have a small test case, I can try to take a look at it.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Troy Gilbert
Sent: Wednesday, March 05, 2008 8:01 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Global keyboard capture?

 

 This is why Rick's suggestion of both a capture and non-capture phase
 listener on stage is correct.

Which is what I was doing originally, as per the source code in my first
post.

If a display object has the focus, then is removed from the stage,
does it automatically lose the focus (I would think so) even if it
still has event listeners registered?

Troy.

 



[flexcoders] Global keyboard capture?

2008-03-04 Thread thirtyfivemph
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.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyboard, false,
int.MAX_VALUE);
stage.addEventListener(KeyboardEvent.KEY_UP, handleKeyboard, false,
int.MAX_VALUE);
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyboard, true,
int.MAX_VALUE);
stage.addEventListener(KeyboardEvent.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.




Re: [flexcoders] Global keyboard capture?

2008-03-04 Thread Sherif Abdou
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: flexcoders@yahoogroups.com
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.


 


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


Re: [flexcoders] Global keyboard capture?

2008-03-04 Thread Troy Gilbert
 For Flex, use systemManager instead of stage from what i was told and the
 capture. no idea on combo sorry

Doesn't make a difference.

The stage should be as low-level as it gets... shouldn't all keyboard
events pass through the stage in either the capture or bubble phase?
Maybe I'm missing something about how keyboard events work...

Troy.


Re: [flexcoders] Global keyboard capture?

2008-03-04 Thread Jeffry Houser

  Keep in mind that something must broadcast the event.  a TextInput 
will broadcast a keyboard event.  A container or Application will not.

Troy Gilbert wrote:
 
 
   For Flex, use systemManager instead of stage from what i was told and the
   capture. no idea on combo sorry
 
 Doesn't make a difference.
 
 The stage should be as low-level as it gets... shouldn't all keyboard
 events pass through the stage in either the capture or bubble phase?
 Maybe I'm missing something about how keyboard events work...
 
 Troy.
 
 

-- 
Jeffry Houser
Flex, ColdFusion, AIR
AIM: Reboog711  | Phone: 1-203-379-0773
--
Adobe Community Expert 
http://www.adobe.com/communities/experts/members/JeffryHouser.html
My Company: http://www.dot-com-it.com
My Podcast: http://www.theflexshow.com
My Blog: http://www.jeffryhouser.com



Re: [flexcoders] Global keyboard capture?

2008-03-04 Thread Troy Gilbert
  Keep in mind that something must broadcast the event. a TextInput
  will broadcast a keyboard event. A container or Application will not.

Keyboard events are broadcast by the player. I'm looking to grab (or
look at) all of them. It shouldn't be dependent on anyone broadcasting
them.

Troy.


Re: [flexcoders] Global keyboard capture?

2008-03-04 Thread Jeffry Houser

  In my experience (which was actually with AIR, not a Flex browser 
based app) they are.  Listening to keyboard events at the main 
windowedApplication did nothing.

  Also, I'll add that any Caught keyboard event did not continue to 
bubble up to the main WindowedApplication (unless you rebroadcast).



Troy Gilbert wrote:
 
 
   Keep in mind that something must broadcast the event. a TextInput
   will broadcast a keyboard event. A container or Application will not.
 
 Keyboard events are broadcast by the player. I'm looking to grab (or
 look at) all of them. It shouldn't be dependent on anyone broadcasting
 them.
 
 Troy.

-- 
Jeffry Houser
Flex, ColdFusion, AIR
AIM: Reboog711  | Phone: 1-203-379-0773
--
Adobe Community Expert 
http://www.adobe.com/communities/experts/members/JeffryHouser.html
My Company: http://www.dot-com-it.com
My Podcast: http://www.theflexshow.com
My Blog: http://www.jeffryhouser.com



RE: [flexcoders] Global keyboard capture?

2008-03-04 Thread Rick Winscot
If you are looking for 'global' application keyboard events. you might want
to attach your listeners at the stage level. Remember though, that your
application will have to have focus in order to process stage events. If you
are looking for operating system level hooks. you are going to hit a wall.
Being able to capture true 'global' key/mouse events (at the operating
system level) has unimaginable security implications. I think that it's safe
to say that that is where the line will be drawn for some time. Global
application events = no problem. Global operating system events = no touchy.

 

Rick Winscot 

 

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jeffry Houser
Sent: Tuesday, March 04, 2008 6:08 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Global keyboard capture?

 


In my experience (which was actually with AIR, not a Flex browser 
based app) they are. Listening to keyboard events at the main 
windowedApplication did nothing.

Also, I'll add that any Caught keyboard event did not continue to 
bubble up to the main WindowedApplication (unless you rebroadcast).

Troy Gilbert wrote:
 
 
  Keep in mind that something must broadcast the event. a TextInput
  will broadcast a keyboard event. A container or Application will not.
 
 Keyboard events are broadcast by the player. I'm looking to grab (or
 look at) all of them. It shouldn't be dependent on anyone broadcasting
 them.
 
 Troy.

-- 
Jeffry Houser
Flex, ColdFusion, AIR
AIM: Reboog711 | Phone: 1-203-379-0773
--
Adobe Community Expert 
http://www.adobe.com/communities/experts/members/JeffryHouser.html
My Company: http://www.dot-com-it.com
My Podcast: http://www.theflexshow.com
My Blog: http://www.jeffryhouser.com

 

image001.jpgimage002.jpg

RE: [flexcoders] Global keyboard capture?

2008-03-04 Thread Rick Winscot
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Sherif Abdou
Sent: Tuesday, March 04, 2008 2:43 PM
To: flexcoders@yahoogroups.com
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: flexcoders@yahoogroups.com
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.jpgimage002.jpg

Re: [flexcoders] Global keyboard capture?

2008-03-04 Thread Troy Gilbert
 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…

You should've read all the way back to my original post... the code I
posted was adding exactly that to the stage (with the addition of
being highest priority as well).

@Alex: could I force keyboard focus to the stage using something like
stage.setFocus()?

Troy.


--
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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 


RE: [flexcoders] Global keyboard capture?

2008-03-04 Thread Alex Harui
For the record, so there is no more guessing:

 

1)   The Application or WindowedApplication is not the top-level
window and does not parent popup and thus events from popups do not
bubble through the application

2)   SystemManager is the top-level window, and all events from all
display objects bubble through the SM unless their propagation has been
stopped

3)   Capture phase listeners on the SystemManager should get all
events for all child display objects

4)   If no display object has focus, but the player does have focus,
then the Stage dispatches keyboard events which will not be caught by a
listener on SystemManager

5)   Capture phase listeners on the Stage will not catch events
dispatched from the Stage, only events dispatched by children of the
Stage and thus if no display object has focus, there is no place to hook
a capture-phase listener that will catch the keyboard events dispatched
from the stage.

 

This is why Rick's suggestion of both a capture and non-capture phase
listener on stage is correct.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Rick Winscot
Sent: Tuesday, March 04, 2008 8:18 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Global keyboard capture?

 

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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Sherif Abdou
Sent: Tuesday, March 04, 2008 2:43 PM
To: flexcoders@yahoogroups.com
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: flexcoders@yahoogroups.com
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 your homepage.
http://us.rd.yahoo.com/evt=51438/*http:/www.yahoo.com/r/hs  

 



Re: [flexcoders] Global keyboard capture?

2008-03-04 Thread Josh McDonald
A whole bunch of useful info there, cheers :D

If you're listening on both phases to event X, will your handler be called
twice?

-J

On Wed, Mar 5, 2008 at 3:02 PM, Alex Harui [EMAIL PROTECTED] wrote:

For the record, so there is no more guessing:



 1)   The Application or WindowedApplication is not the top-level
 window and does not parent popup and thus events from popups do not bubble
 through the application

 2)   SystemManager is the top-level window, and all events from all
 display objects bubble through the SM unless their propagation has been
 stopped

 3)   Capture phase listeners on the SystemManager should get all
 events for all child display objects

 4)   If no display object has focus, but the player does have focus,
 then the Stage dispatches keyboard events which will not be caught by a
 listener on SystemManager

 5)   Capture phase listeners on the Stage will not catch events
 dispatched from the Stage, only events dispatched by children of the Stage
 and thus if no display object has focus, there is no place to hook a
 capture-phase listener that will catch the keyboard events dispatched from
 the stage.



 This is why Rick's suggestion of both a capture and non-capture phase
 listener on stage is correct.


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Rick Winscot
 *Sent:* Tuesday, March 04, 2008 8:18 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] Global keyboard capture?



 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:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Sherif Abdou
 *Sent:* Tuesday, March 04, 2008 2:43 PM
 *To:* flexcoders@yahoogroups.com
 *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: flexcoders@yahoogroups.com
 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 your 
 homepage.http://us.rd.yahoo.com/evt=51438/*http:/www.yahoo.com/r/hs

  




-- 
Therefore, send not to know For whom the bell tolls, It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


RE: [flexcoders] Global keyboard capture?

2008-03-04 Thread Alex Harui
Yes there will be situations where you see the event on both the capture
and bubble phases.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh McDonald
Sent: Tuesday, March 04, 2008 9:09 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Global keyboard capture?

 

A whole bunch of useful info there, cheers :D

If you're listening on both phases to event X, will your handler be
called twice?

-J

On Wed, Mar 5, 2008 at 3:02 PM, Alex Harui [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  wrote:

For the record, so there is no more guessing:

 

1)   The Application or WindowedApplication is not the top-level
window and does not parent popup and thus events from popups do not
bubble through the application

2)   SystemManager is the top-level window, and all events from all
display objects bubble through the SM unless their propagation has been
stopped

3)   Capture phase listeners on the SystemManager should get all
events for all child display objects

4)   If no display object has focus, but the player does have focus,
then the Stage dispatches keyboard events which will not be caught by a
listener on SystemManager

5)   Capture phase listeners on the Stage will not catch events
dispatched from the Stage, only events dispatched by children of the
Stage and thus if no display object has focus, there is no place to hook
a capture-phase listener that will catch the keyboard events dispatched
from the stage.

 

This is why Rick's suggestion of both a capture and non-capture phase
listener on stage is correct.

 



From: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ]
On Behalf Of Rick Winscot
Sent: Tuesday, March 04, 2008 8:18 PM
To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 
Subject: RE: [flexcoders] Global keyboard capture?

 

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: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ]
On Behalf Of Sherif Abdou
Sent: Tuesday, March 04, 2008 2:43 PM
To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 
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]
mailto:[EMAIL PROTECTED] 
To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 
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 your homepage.
http://us.rd.yahoo.com/evt=51438/*http

RE: [flexcoders] Global keyboard capture?

2008-03-04 Thread Alex Harui
stage.focus = null;

However, the FocusManager may fight to put the focus somewhere.

Yeah, I recall that you were adding priority as int.MAX_VALUE.  Did you
try it with default priority?  I'm not sure if there are issues using
MAX_INT as priority.

Do you have default wmode or are you using some other wmode?  Are there
other focusable widgets in the HTML wrapper?

When you only see keydown and no keyup, is the control with focus
responding?  If you put a target phase listener on that control is it
reporting the KEY_UP event?



-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Troy Gilbert
Sent: Tuesday, March 04, 2008 9:00 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Global keyboard capture?

 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...

You should've read all the way back to my original post... the code I
posted was adding exactly that to the stage (with the addition of
being highest priority as well).

@Alex: could I force keyboard focus to the stage using something like
stage.setFocus()?

Troy.


--
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