Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Dragging does not work

$
0
0

Hey,

i have tried several things, but nothing really works. Hopefully one of you know the answer :)

Situation: I do have a grid of images, and i can "mark" this images via a click. Now i wanna:

(if i marked one and start a drag)

  1. create a icon on the touchstart position
  2. possible to drag this icon to another position( eg. top "drop" it over a button)

So i don't wanna move the image itself. I am using this for a beginning, but it's not working - really...

function onTouchStart(e) {
    console.log("Touch Start");
    dragObject = Titanium.UI.createView({
        width : 35,
        height : 35,
        backgroundColor : '#ff00ff'
    });
    $.win.add(dragObject);
 
 
    dragObject.addEventListener('touchmove', onTouchMove);
 
}
 
function onTouchMove(e) {
    dragObject.left = e.x + dragObject.animatedCenter.x;
}

My conceptproblem is: The dragobject should be created on touchstart, but the touchmove should be register on the object, not the image that triggered the touchstart event.

Any idea?

( Only ios7, SDK 3.2)


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>