Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2009

    Post Help with Touch Gestures, convert to key strokes?

    Hello all,

    I was trying to convert touch gestures to key strokes. This is because I wanted to implement touch capability in my already compiled app.

    Here's an example of what I wanted to do:

    if(gestureFlags & LEFT_TO_RIGHT)
    log("left to right gesture");

    The above code suggests the left to right gesture to be logged. However, could anyone suggest a code to interpret the left to right gesture as pressing the right key?

    I got the touch gesture code here:

    All help is appreciated! Thanks.

  2. #2
    Registered User
    Join Date
    Apr 2008
    India / Singapore

    Re: Help with Touch Gestures, convert to key strokes?

    HI ,
    I would like to bring to your notice that ordinary apps when played on a touch device, display a virtual keypad with the 5 navigation keys and 2 softkeys. U can also disable this with a FSCOmmand

    Can you rephrase your question and make it more simple...

    Twitter - manikantan_k
    Just in --

  3. #3
    Registered User
    Join Date
    Jul 2008

    Re: Help with Touch Gestures, convert to key strokes?

    Hey there,

    You won't be able to convert them, but here's my suggestion. Create individual functions for each of the Key events you are monitoring, then call them from your existing Key listener. Once that's done, call the new individual functions from the gesture detection code you have (in the same place that you have the log() method now). That way, both events, key press and gesture, are able to call the individual methods.

    Here's an example...


    this.onKeyDown = function() {
    if(Key.getCode() == 39){

    function keyDownRight(){
    trace("right key pressed")

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2006
    Mumbai, India

    Re: Help with Touch Gestures, convert to key strokes?


    Ideally you would be using either touch or keys in an application on a device. But if you wish to include both these features for interaction, I think a better solution would be to have it identify both touch and keystrokes with separate listeners. For instance -

    var gesturesListener:Object = new Object();
    var keysListener:Object = new Object();

    gesturesListener.onMouseDown = function(){
    gesturesListener.onMouseUp = function(){
    keysListener.onKeyUp = function(){

    Then when you log your touch gesture (lets say Left-Right), you know this would equal to a Right key pressed. So when you switch from Touch interaction to Key interaction, you can use your logged value to carry out the rest of the interaction with the keys. This can work the other way as well.

    Mariam Dholkawala

    Blog - http://www.mariamdholkawala.com/mobile
    MaD UG - http://www.indimadgroup.com

Similar Threads

  1. Reading Key Strokes in mobile using java
    By jayakrishnan.salim in forum Mobile Java General
    Replies: 6
    Last Post: 2009-06-19, 04:59
  2. Activating key board in touch pad.
    By duttaa in forum Mobile Java General
    Replies: 1
    Last Post: 2008-12-23, 15:36
  3. phone app & long press red key
    By morost in forum Symbian
    Replies: 2
    Last Post: 2007-09-21, 07:51

Posting Permissions

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