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

Native Development

Reply
Developer
Posts: 112
Registered: ‎10-10-2010
My Device: Torch
My Carrier: Verizon
Accepted Solution

Picture touch location. How to?

I'm looking for a sample app that gives feedback on where the user touches the screen. But I'm more interested in imagine if possible. Does anyone have a sample app for it. I looked around but I can't find it. But I know there was one last year for screen response. I looked at the API reference and documention under touch options but with no luck. Just need something that finds out on what part the image the user touches.

 

Thanks,

Cozz

______________________________________________
Android dev jumping ship to BB. Cascade newbie. Any help would be great. Miss the Visual Basic days.

Updated my pin
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Picture touch location. How to?

[ Edited ]

if you throw in onTouch to your imageview, or container holding the image, it will notify you of touchEvents

 

Container {
    onTouch: {
       if event.isDown(){
          console.log("touch down X:" + event.localX + " Y: + event.localY)
       }
       if event.isUp(){
          console.log("touch up X:" + event.localX + " Y: + event.localY)
       }
    }
}

 if you want to know if they tapped or longpressed, use a gestureHandler

Highlighted
Developer
Posts: 112
Registered: ‎10-10-2010
My Device: Torch
My Carrier: Verizon

Re: Picture touch location. How to?

Sorry for the delay as I went on vacation for a while. I wanted to say the ontouch method you mentioned worked perfectly. Thank you for the help.

______________________________________________
Android dev jumping ship to BB. Cascade newbie. Any help would be great. Miss the Visual Basic days.

Updated my pin