0

onColorKeyPress

I can't seem to handle these events in fullscreen mode.

The relevant code is below but the event is never triggered.

CODE
var InGameView = new KONtx.Class({

ClassName: 'InGameView',

Extends: KONtx.system.FullscreenView,

initialize: function () {

this.parent();

this._myKeyHandler.subscribeTo(KONtx.application, "onColorKeyPress");
},

_myKeyHandler:function(event) {

log(event.payload.color);
},

});


The only output I see from "\key green" etc. is

CODE
/key green
WM 00:00:38:703: [T:13142] ** Keys.handleKey() @key code 404 @target fs @current fs @phase 2
WM 00:00:38:703: [T:13142] ******** Utils.Doggy.poke()
WM 00:00:38:703: [T:13142] ** main._updateScreensaver() @do poke true @doggy 1 alive true @doggy 1 asleep false @doggy 2 alive true @doggy 2 asleep false
WM 00:00:38:703: [T:13142] ******** Utils.Doggy.poke()
WM 00:00:38:703: [T:13142] ******** Utils.Doggy.poke()


I've checked similar threads on this forum and cannot see what I'm doing wrong.



On a possibly related issue, I can't seem to detect "onBlockedKeyPress" events either. I've had to define my blockedKeys list using "prototype" eg

KONtx.videoplayer.prototype.keys.PAUSE,

instead of

KONtx.videoplayer.keys.PAUSE,

However, I can detect all widget key presses ok using

CODE
widget.addEventListener('keydown', function ( KFEvent ) { self.keyHandler ( KFEvent ) }, false );




wdkversion=0.9.7.6

by
12 Replies
  • Based on the log you posted, the key code is correct at 404, but the phase is 2. The framework only checks when the event is in phase 3 using the below code.

    CODE
    if(KFEvent.eventPhase == 3 && $contains(KFEvent.keyCode, [403,404,405,406]) !== false)

    Did you try switching the context to 1 before issuing the /key color command, as mentioned in post http://developer.yahoo.net/forum/index.php?showtopic=3910?
    0
  • QUOTE (Steve @ Jan 21 2010, 05:18 AM) <{POST_SNAPBACK}>
    Based on the log you posted, the key code is correct at 404, but the phase is 2. The framework only checks when the event is in phase 3 using the below code.

    CODE
    if(KFEvent.eventPhase == 3 && $contains(KFEvent.keyCode, [403,404,405,406]) !== false)

    Did you try switching the context to 1 before issuing the /key color command, as mentioned in post http://developer.yahoo.net/forum/index.php?showtopic=3910?


    Hi Steve

    Yeah, the output above is after I've used "/widgets 1" from the dock.
    0
  • Re: prototype comment on blocked keys, yes, unfortunately this is required due to an artifact of how the old video player API was implemented. This is much cleaner and better supported in the new API.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Jan 21 2010, 08:20 AM) <{POST_SNAPBACK}>
    Re: prototype comment on blocked keys, yes, unfortunately this is required due to an artifact of how the old video player API was implemented. This is much cleaner and better supported in the new API.

    -Jeremy



    Thanks Jeremy

    Can you see where I'm going wrong with handling the colour key presses?

    I can detect them with my keydown handler widget.addEventListener('keydown', ... but understand that this is not the correct way to do it.
    0
  • QUOTE (marc.coupar @ Jan 21 2010, 08:34 AM) <{POST_SNAPBACK}>
    Thanks Jeremy

    Can you see where I'm going wrong with handling the colour key presses?

    I can detect them with my keydown handler widget.addEventListener('keydown', ... but understand that this is not the correct way to do it.


    I meant to add that as Steve points out, I can only see the phase==2 state of the keypress when using "/key green" whereas the keydown handler registers states 1 & 3.
    0
  • Anyone got any input into this?
    0
  • Sorry read through this and I'm now missing where your issue lies?

    From my read it sounds like using the keydown handler is the way to go? (If it works I wouldn't call it wrong ;-)
    0
  • QUOTE (Mike R. @ Jan 21 2010, 05:56 PM) <{POST_SNAPBACK}>
    Sorry read through this and I'm now missing where your issue lies?

    From my read it sounds like using the keydown handler is the way to go? (If it works I wouldn't call it wrong ;-)


    Hi Mike

    Other threads where people have experienced the same problem (such as this one http://developer.yahoo.net/forum/index.php...onColorKeypress ) state that we're supposed to use onColorKeyPress. I'd rather do it using the recommended method if there's a risk my app might fail submission.

    Cheers
    Marc
    0
  • QUOTE (marc.coupar @ Jan 22 2010, 02:30 AM) <{POST_SNAPBACK}>
    Hi Mike

    Other threads where people have experienced the same problem (such as this one http://developer.yahoo.net/forum/index.php...onColorKeypress ) state that we're supposed to use onColorKeyPress. I'd rather do it using the recommended method if there's a risk my app might fail submission.

    Cheers
    Marc

    I think your only option might be to modify the framework code for the simulator you are using to accept phase 2 events.
    0
  • This is only an issue with the WDK, not with TVs, so begrudgingly I would probably recommend making the tweak to the framework application.js code temporarily so you can continue testing/development.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Jan 22 2010, 09:26 AM) <{POST_SNAPBACK}>
    This is only an issue with the WDK, not with TVs, so begrudgingly I would probably recommend making the tweak to the framework application.js code temporarily so you can continue testing/development.

    -Jeremy


    Ah ok, thanks Jeremy.

    Are there any known WDK issues with the "blockedKey" functionality as well?

    Subscribing to 'onBlockedKeyPress' doesn't seem to register any of the blocked keys I set. I've only tested on the Simulator so far but have a Samsung here I can test on too.

    Marc
    0
  • QUOTE (marc.coupar @ Jan 22 2010, 09:44 AM) <{POST_SNAPBACK}>
    Subscribing to 'onBlockedKeyPress' doesn't seem to register any of the blocked keys I set. I've only tested on the Simulator so far but have a Samsung here I can test on too.


    I've not tested on the WDK recently in that regard, but I would guess it's probably the similar issue.

    -Jeremy
    0

Recent Posts

in General - Yahoo! TV Widgets