Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Developer
Posts: 15
Registered: ‎03-25-2012
My Device: Q10, PlayBook
My Carrier: Bell

Touch Event problem

Hello,

 

The problem I am having is if you swipe quickly and lightly from the screen to a bezel on any side, my 'onRelease' functions are not getting called...

 

I am guessing 1 of 2 things is happening:

 

1. It is fooled into thinking the user is still pressing, and so it continues to call my 'onBegin' function

2. There is a different event that is occuring which I am not monitoring for.

 

I am monitoring these touch events:

 

e.addEventListener(TouchEvent.TOUCH_ROLL_OVER, onBegin);

e.addEventListener(TouchEvent.TOUCH_BEGIN, onBegin);

e.addEventListener(TouchEvent.TOUCH_MOVE, onBegin);

e.addEventListener(TouchEvent.TOUCH_ROLL_OUT, onRelease);

e.addEventListener(TouchEvent.TOUCH_END, onRelease);

 

Please help! This is driving me nuts. Smiley Mad

Developer
Posts: 172
Registered: ‎01-17-2011
My Device: 9500 series
My Carrier: Airtel

Re: Touch Event problem

HI 1337

Strange name

add

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

to identify OS that you are going to use touch events.

Thanks

Shashank

New Developer
Posts: 15
Registered: ‎03-25-2012
My Device: Q10, PlayBook
My Carrier: Bell

Re: Touch Event problem

Hi shaan,

 

I do have that in my code just above those lines, sorry I neglected to mention this. So even with this, something strange is happening. In the neighborhood.

Highlighted
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Touch Event problem

does it have to be touchevents? i'm having an application where you can drag qnx.ui.containers around, and i'm using this

 

			this.addEventListener(MouseEvent.MOUSE_DOWN, onBegin);
			this.addEventListener(MouseEvent.MOUSE_UP, onEnd);
			this.addEventListener(MouseEvent.MOUSE_OUT, onEnd);

 i had the same problem as you, if i remember correctly, that's why i had to add MOUSE_OUT.

the reason for the mouseevents is because in the first versions of the sdk, there were no working touchevents

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
New Developer
Posts: 15
Registered: ‎03-25-2012
My Device: Q10, PlayBook
My Carrier: Bell

Re: Touch Event problem

[ Edited ]

Thanks pyth,

 

This solved my issue, but created a new one Smiley Happy

 

My app has controls on the left and right side of the tablet. I added the mouse events to the left side, and the right side still uses touch events.

 

So now if you press the right side controls first, the mouse cursor will stay on that side and ignore when you press on the left controls. Smiley Sad

 

Is it the containers you are referring to that would stop this issue with the mouse?

Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Touch Event problem

[ Edited ]

i guess that happens because of the mouse events. because for the mouse, there's always just one single reference point. the containers wouldn't help

 

so if you have multitouch, i guess you must use touch events :/

 

btw, have you tried monitoring TOUCH_OUT ?

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
New Developer
Posts: 15
Registered: ‎03-25-2012
My Device: Q10, PlayBook
My Carrier: Bell

Re: Touch Event problem

Yes. I still have this issue using touch_out.

 

This seems to be a bug!

Contributor
Posts: 48
Registered: ‎02-11-2012
My Device: playbook 16 gig
My Carrier: verizon

Re: Touch Event problem

on android and iOS, I had a sprite that listened for touch over and out. It worked 100% perfect if you drag over/out or if you just touch/release on it. No need for touch begin/end On playbook, It did recognize if you touched it directly, but had some delay. So I added all 4- begin,end,over and out. This worked properly, but I ran into the same issue as you, if you swipe it real quick, it may get the touch over or begin, but miss the touch out. And since you may be lifting your finger while its already off the button, the touch end is missed as well. Also, I ran into an issue where it misses the events if you lift your finger exactly on the line of graphics, example: vector art with a drawn circle and fill, if you lift your finger on the line of the art, it misses both the touch end and touch out. ( In regards to testing for event.target ) This was confirmed with a giant line style for testing Anyway, the good news is touch begin and end DO always fire, even if they miss the target due to the lines, just store your touch points and react to touch end on that specific touch point. Or what I did was check the coordinates, since my buttons are on the bottom left and right corners, I simply treat it as a touch end when the finger lifts in the general area. This is in combination with touch begin,end, over, and out. with these 5 checks, I am able to tap or roll over/out and it works as I want it to. ...that is, unless some jerk swipes very quickly from button to center of stage and lets go.... then the touch out can be missed and button would get stuck in...If someone does this and complains, I will use the touch point storing method.
Contributor
Posts: 48
Registered: ‎02-11-2012
My Device: playbook 16 gig
My Carrier: verizon

Re: Touch Event problem

sorry for the poor formatting, I have a script blocker or something that mashed it all togetherSmiley Happy