Archive for May, 2011

TLFTextfield blocking “ENTER” Keyboard event

Probably my last post about TLFTextfied for a little while. This is going to be a quick one and was actually found by my colleague Will Adams. Also he found the solution somewhere else on the web but I can’t find it anymore so I thought it would be good to post it here too.

So here is the problem, if you use TLFTexfields as input fields for your form and you want to listen for the user pressing the “ENTER” key to submit the form, if at that moment the focus is on the input field, you won’t be able to listen for it. So normally, you would put the Keyboard event listener on the stage so that it doesn’t matter which textfield the user is on, if he presses “ENTER”, it will submit the form. Turns out that for some reasons, TLFTextfield will block that event from firing. Funny thing, is that it doesn’t block other key press events from firing just the “ENTER” (or “RETURN”).

Now for the quick fix:

_tlfTextfield.getChildAt(1).addEventListener(KeyboardEvent.KEY_UP, _onKeyPressed);

So you will have to add this to every of your textfields, which is a bit annoying, but it will make it work. I don’t know how the guy that found this found it, but I’m sure glad he did.



Gamification of fitness

Now they are applying gamification to everything, I had also this idea that if I was a Wii fit game developer, I would build a Role Playing Game (RPG) based on exercise. The concept would be pretty simple, you have a set of exercises to start with and that is what you use to defeat monsters. As you defeat monsters you gain levels which unlocks new harder exercises (more tiring exercises). I think there is a limit of how much of these exercises you can do a day, so you couldn’t complete the game in one run, but basically you would stop because you are too tired to go on. You come back the next day and you start were you left off but you are well rested. It kinda makes me think of games like Farmville where you only have a limited number of action each day but instead of that limit being fictive and imposed by the game, it would be a real limit. I like that spin on it, it would make fitness a bit more fun and interesting, a plot would unfold as you kill more monsters. And if for a few days you don’t kill anything, your level would go down a bit, so that it wouldn’t be too hard to pick the game back up. Anyway I thought this idea was good enough to share.

, , , , ,

1 Comment

Parse error: syntax error, unexpected ';' in /homepages/25/d169645162/htdocs/wp-content/themes/fusion/footer.php on line 13