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
Developer
Posts: 71
Registered: ‎01-06-2011
My Device: Not Specified
Accepted Solution

UI Help

In an app that I'm creating, comonents of it (which are sprites) need to be moved around, connected, and disconnected by the user. Right now, I use Mouse_Down, Mouse_Move and Mouse_Up for the movement, and I have set up a double-click to work with the connecting. I need another gesture/whatever for the user to do for disconnecting. I don't want to add a button to switch between connecting and disconnecting, since I'd like them to be able to do both on the fly. 

Any suggestions for the type of event I should hook the disconnecting up to?

---
My Apps:
KeepUp (http://appworld.blackberry.com/webstore/content/26514?lang=en)
Developer
Posts: 1,176
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: UI Help

[ Edited ]

If you don't have to have the project done before you get a device in hand then perhaps a two finger spreading gesture would be a good "disconnect" gesture.  (Simulator doesn't support multitouch but the AIR API's do.)

 

Edit:  This would involve some 2d geometry computation, but another possibility might be to detect a single finger swipe gesture that is intended to cut an imaginary connection between the two sprites (assuming of course that their geometries are such that a "cut" swipe gesture would seem intuitive).

Developer
Posts: 71
Registered: ‎01-06-2011
My Device: Not Specified

Re: UI Help

I forgot to mention, when the device is released I plan to use a two-finger thing to resize the sprites. I like the idea of "cutting" the connection though. I was thinking of something like this too, (after playing fruit ninja on my friends ipod), but I'm not exactly sure how to go about this sort of thing. Would it require touch events or anything that is not testable in the simulator?

---
My Apps:
KeepUp (http://appworld.blackberry.com/webstore/content/26514?lang=en)
Developer
Posts: 1,176
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: UI Help

For now to be safe you could probably do something like this to avoid depending on any gesture API stuff:

 

On a mouse down set a state variable and save the mouse down coordinates.  On a mouse up get the coordinates for the mouse up, and compute the line segment from the mouse down location to the mouse up location.  Then compute whether that line segment crosses a line segment representing a connection between your two connected sprites.

 

Just thinkin' out loud.

Developer
Posts: 71
Registered: ‎01-06-2011
My Device: Not Specified

Re: UI Help

Ok, thanks!

---
My Apps:
KeepUp (http://appworld.blackberry.com/webstore/content/26514?lang=en)