dragging - how is it done? 
Posted: 18 November 2008 09:35 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  161
Joined  2008-05-31

I was wondering how dragging was done.
With a single pointer it is easy.

But with this we need to follow multi drags.

If I have a set amount of pieces on the stage, I would imaging that I need someway to say onEnterFrame this x,y = that blob x,y.

The only way I could think of is to have each sprite an array that has a flag set when it is being dragged (inDrag), and the blob it belongs to. Then cycle through all the sprites, looking for one that has inDrag = true, and set it’s x/y to that of the blob that we set. Then when we stop, delete the inDrag flag, and the blob number.

That sounds like way too much work though.

Im my drawing app, each line is named after the blob it is attached to so it is easy to know what to follow.

Profile
 
 
Posted: 18 November 2008 10:50 PM   [ Ignore ]   [ # 1 ]
Jr. Member
RankRank
Total Posts:  119
Joined  2007-06-06

Why not look at the source code to the flash apps? In C# the way I do this is by “capturing” the item I am dragging and store a reference to it on my touch object that way I can just fire off the touch move event to it without doing any hit testing...then when dropped i release the captured item.

Profile
 
 
Posted: 19 November 2008 02:02 AM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1496
Joined  2007-04-08

All you need to do is extend rotateablesclable and you have the ability to drag anything that extends it. You can then choose to set noScale and noRotate to true if you only want the object to move. We’ll have a move only extend soon.

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
Posted: 19 November 2008 08:26 AM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  161
Joined  2008-05-31

LOL
At first I was like “Im already extending it”.
30sec later…
I took my class that makes the sprites on the stage, extended it, and bingo!
Man that was easy.
Im really over thinking some stuff.

Thanks again!

cerupcat - 19 November 2008 02:02 AM

All you need to do is extend rotateablesclable and you have the ability to drag anything that extends it. You can then choose to set noScale and noRotate to true if you only want the object to move. We’ll have a move only extend soon.

Profile
 
 
Posted: 19 November 2008 01:32 PM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1496
Joined  2007-04-08

Hehe yeah. I don’t blame you though, the documentation we have is kind of poor. Once lux is out it’ll be much easier smile

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
Posted: 19 November 2008 01:48 PM   [ Ignore ]   [ # 5 ]
Jr. Member
RankRank
Total Posts:  161
Joined  2008-05-31

I hope you dont run me out of a job… I like being helpful when I can.

cerupcat - 19 November 2008 01:32 PM

Hehe yeah. I don’t blame you though, the documentation we have is kind of poor. Once lux is out it’ll be much easier smile

Profile
 
 
Posted: 19 November 2008 02:05 PM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1496
Joined  2007-04-08

Not sure what you mean hehe. We can always use your help!

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
Posted: 19 November 2008 02:07 PM   [ Ignore ]   [ # 7 ]
Jr. Member
RankRank
Total Posts:  161
Joined  2008-05-31

If things get too well documented and easy to use, who needs me. =)

Profile
 
 
Posted: 19 November 2008 02:11 PM   [ Ignore ]   [ # 8 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1496
Joined  2007-04-08

We’ll need people to help with documentation smile You’re on the list now hehe.

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile