×

Discussion Board

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

    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:
    http://www.jappit.com/blog/2009/02/2...in-flash-lite/

    All help is appreciated! Thanks.

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

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

    Thanks
    Twitter - manikantan_k
    Just in --

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    3

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

    Key.addListener(this);

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

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

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

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

    Hi,

    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(){
    doSomething();
    }
    gesturesListener.onMouseUp = function(){
    doSomething();
    checkGesture();
    }
    keysListener.onKeyUp = function(){
    trace(Key.getCode());
    doSomething();
    }
    Mouse.addListener(gesturesListener);
    Key.addListener(keysListener);

    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
    Mariam Dholkawala
    http://www.igamestudio.com

    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 C++
    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
  •