A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: KeyboardEvent Observer Without focus

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Location
    UK
    Posts
    493

    KeyboardEvent Observer Without focus

    I am trying to implement the Observer pattern for a keyBoardEvent class that handles the key events and notifies all subscribers (basically centralises the event handling and updates those that need to know)

    New to Patterns and As3.0 and seems the
    Code:
    addEventListener(KeyboardEvent.KEY_DOWN)
    requires the displayObject to have focus but if it loses it wont trigger...which makes sense.

    However, there must be a way to force the class to listen for KeyBoardEvents regardless of focus? extedning the KeyBoordEvents Class prehaps?

    Any pointer on this would be greatly appreciated

    Cheers
    Jon

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You could add the listener to the stage instead.

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Location
    UK
    Posts
    493
    Yes, but that still leaves the problem if another displayObject acquires the focus the class then cant track the keyboardEvents.

    i need to bypass the focus restriction and track the Events from a global stand point....regradless of what has currently got the keyboard focus.

    Hope that makes more sense?

    Anyone any idea?

    Thanks
    JOn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center