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

New Developer
Posts: 5
Registered: ‎12-22-2010
My Device: Not Specified

Mouse / Touch events

Does anyone know if the mouseX and mouseY properties of DisplayObject can be used to find where the last touch was?


I'm asking this because that's the way that the Flixel library gets it's mouse location. If anyone has used Flixel successfully on a touch device, that would be good to know as well.



Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Mouse / Touch events

I don't really know what Flixel is, but the most obvious way the get the coordinates is to get them from the MouseEvent.



public function onMouseClick(event:MouseEvent):void{



BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
New Developer
Posts: 5
Registered: ‎12-22-2010
My Device: Not Specified

Re: Mouse / Touch events

Flixel is a game development library for Flash.


Yes, getting the click event is a straightforward way of getting the tocuh location, but not exactly what I need. I'm hoping to follow the location as the user drags their finger around the screen.


This is a whole lot easier if DisplayObject.mouseX / Y works, as none of the library would need to be modified for using touch.

Posts: 274
Registered: ‎11-01-2010
My Device: PlayBook?
My Carrier: WiFi

Re: Mouse / Touch events

Don't see why it should function any differently than a mouse cursor leaving the screen ( though I haven't actually tested on a touch device).


If you have to you can always just use a MOUSE_MOVE event to pass mouseX and mouseY to your own variables.


Haven't worked with flixel, so no idea what's involved on that side.

Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Mouse / Touch events

Given that the APIs have startDrag() for the mouse, and startTouchDrag() for touch, I somehow suspect that Flash treats mouse and touch as two separate, independent, channels of input and you shouldn't expect to get data about touch (which, after all, can have more than one point active) from anything to do with the mouse.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Mouse / Touch events

Touch functions have to keep track and report which touch device is being used.  The PB has 4 touch devices (finger points).  Mouse functions only have to keep track of 1 and since the API needs to support desktop, browser, and single touch mobile as well as multi-touch devices, two sets of API categories makes sense.

New Developer
Posts: 100
Registered: ‎03-16-2011
My Device: curve
My Carrier: sprint

Re: Mouse / Touch events

Hey there, been a little bit since anyone replied to this thread, I just wanted to let you know someone else is using flixel.


I have been using FlxG.mouse.x and FlxG.mouse.y in conjuction with FlxG.mouse.pressed(). it seems if it's pressed it is registering a touch event, if not pressed the mouse.x&y return last known. I am using this during an update loop and it seems to be working fine. Without the playbook it's really hard to be absolutely sure though.


and it's two days to deadline, so if this doesn't work it's probably going to be too late for me Smiley Happy.