Results 1 to 7 of 7
  1.    #1  
    I'm trying to have my app do one thing when a flick happens, and something else when you tap the screen so I have both turned on at the same time.

    The problem is, when I do a flick, sometimes (often) at the end of the flick, I also get a tap. This is screwing up my UI. Has anybody else had this problem and if so, what is the solution?

    Help?
    mobigamedepot.com
  2. #2  
    Quote Originally Posted by djpushplay View Post
    I'm trying to have my app do one thing when a flick happens, and something else when you tap the screen so I have both turned on at the same time.

    The problem is, when I do a flick, sometimes (often) at the end of the flick, I also get a tap. This is screwing up my UI. Has anybody else had this problem and if so, what is the solution?

    Help?
    i had this problem. i have been struggling with it, but reading your post just made me think of a temporary solution.

    the problem is that mojo.event.tap should only occur when an up-and-down event happens within a pre-defined radius. i think that radius is being ignored (or isn't present) by mojo. palm needs to address this.

    what i'm doing is setting up a drag even to get around it.

    Code:
    GameAssistant.prototype.dragStart = function(event) {
    	Element.observe(this.trackingArea, Mojo.Event.dragging, this.draggingHandler);
    	Element.observe(this.trackingArea, Mojo.Event.dragEnd, this.dragEndHandler);
    	
    	this.startX = Event.pointerX(event.down);
    	this.startY = Event.pointerY(event.down);
    	
    	Event.stop(event);
    };
    	
    GameAssistant.prototype.dragging = function(event) {
    	//$('tracking-output').update("x = " + Event.pointerX(event.move))
    	//$('tracking-output').insert("<br>")
    	//$('tracking-output').insert("y = " + Event.pointerY(event.move))
    	this.currX = Event.pointerX(event.move);
    	this.currY = Event.pointerY(event.move);
    	if(Math.abs(this.currX - this.startX) > 20){
    		this.swiped();
    	}
    	if(Math.abs(this.currY - this.startY) > 20){
    		this.swiped();
    	}
    };
    	
    GameAssistant.prototype.dragEnd = function(event) {
    	Element.stopObserving(this.trackingArea, Mojo.Event.dragging, this.draggingHandler);
    	Element.stopObserving(this.trackingArea, Mojo.Event.dragEnd, this.dragEndHandler);
    	Event.stop(event);
    };
    basically i check if i drag more than 20 pixels in the X or Y direction, and if so i call the this.swiped(); function, which was previously tied to Mojo.Event.flick. i've had no problems since, and you can define your distance required as needed. 20 works for me
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  3.    #3  
    Quote Originally Posted by shanerooni View Post
    basically i check if i drag more than 20 pixels in the X or Y direction, and if so i call the this.swiped(); function, which was previously tied to Mojo.Event.flick. i've had no problems since, and you can define your distance required as needed. 20 works for me
    So your this.swiped() function is the same normal event function as the flick function? But doesn't the drag function have a pause before it thinks you are dragging? Or am I thinking about something else?

    I was thinking about trying to do some kind of time check to see if the 2 events come almost at the same time, and if so, ignore the tap. Not sure if this would work. I also noticed that sometimes the tap comes first, then the flick. I guess it's just a timing issue. In either case, it screws up my code. If I ever get this working, (your method or something else) I'll post here again.

    Thanks for your help.
    mobigamedepot.com
  4. #4  
    Quote Originally Posted by djpushplay View Post
    So your this.swiped() function is the same normal event function as the flick function? But doesn't the drag function have a pause before it thinks you are dragging? Or am I thinking about something else?

    I was thinking about trying to do some kind of time check to see if the 2 events come almost at the same time, and if so, ignore the tap. Not sure if this would work. I also noticed that sometimes the tap comes first, then the flick. I guess it's just a timing issue. In either case, it screws up my code. If I ever get this working, (your method or something else) I'll post here again.

    Thanks for your help.
    the method i used is flawless. the this.swiped(); i call is just calling:

    Code:
    GameAssistant.prototype.swiped = function(){
         //whatever you need to do
    }
    i've had no problems with it. you are thinking (probably) about the drag when you need to hold an app icon, then drag it. the pause comes with the hold function, not the drag. for drag, dragStart() happens as soon as you touch the screen, dragging occurs the whole time your dragging, and dragEnd is obvious. give it a shot.

    using this should get rid of your tap issue. i've been testing it on my app since my OP and haven't had a false tap yet.

    cheers
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  5.    #5  
    Okay, it works fine if I "drag" or "flick." However, when I just tap the screen, I don't get a call to the dragStart function (or any of the other functions). I assume this is because there's a minimum diameter that is required before the drag is recognized. Damn this problem.

    [UPDATED]
    I misunderstood you (I think) but figured out that you keep the tap function active. The drag does not cause a tap like the flick does. It seems to work fine now. Thanks a bunch.

    Hope I can help you with something in the future.
    Last edited by djpushplay; 01/21/2010 at 05:12 AM. Reason: Realized I'm a moron
    mobigamedepot.com
  6. #6  
    Quote Originally Posted by djpushplay View Post
    Okay, it works fine if I "drag" or "flick." However, when I just tap the screen, I don't get a call to the dragStart function (or any of the other functions). I assume this is because there's a minimum diameter that is required before the drag is recognized. Damn this problem.

    [UPDATED]
    I misunderstood you (I think) but figured out that you keep the tap function active. The drag does not cause a tap like the flick does. It seems to work fine now. Thanks a bunch.

    Hope I can help you with something in the future.
    glad it worked out for you. like i said, you helped me too. i have struggled with this for weeks, and it wasn't until you posted that at that moment i thought about using the drag in place of the flick. hopefully we're not working on the same app! LOL!
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  7.    #7  
    Quote Originally Posted by shanerooni View Post
    [snip] hopefully we're not working on the same app! LOL!
    Hehe. If it is, I wish you luck because I'm having a lot of problems with mine.
    mobigamedepot.com

Posting Permissions