Touch Event Phase

Basically I have two tables one for the “words” and other for the “imgbtn”.
I have placed 4 images in display and now I want those images to move around using touch how can i do it ?coz the one that i am doing is not working?please help me out I need it desperately.pleasee…

[lua]local function match( event)
if(event.phase == “began”) then
imgbtn[count].x=event.x
imgbtn[count].y=event.y
end
end

for count = 1,2 do
x = x + 250
y = 0

for insideCount = 1,2 do
y = y + 250

totalButtons = totalButtons + 1

temp = math.random(1,#words)
imgbtn[count] = display.newImage(words[temp] … “.jpg”);

imgbtn[count].x = x
imgbtn[count].y = y

imgbtn[count].myName = words[temp]
imgbtn[count].number = totalButtons

table.remove(words, temp)

imgbtn[count]:addEventListener( “touch”, match)

end
end[/lua] [import]uid: 82446 topic_id: 18201 reply_id: 318201[/import]

You’re only setting the x/y properties of the image to event.x/event/y in the “began” phase of the event. You’ll also need to do this in the “moved” phase. To ensure that the image “keeps up” with the touch, you should also look into the setFocus() function - check it out in the Corona API reference. [import]uid: 1294 topic_id: 18201 reply_id: 69564[/import]

http://developer.anscamobile.com/forum/2011/05/05/forum-rules-and-guidelines

Please read point 3 - using proper thread titles is important to keep the forum clean and organized, as well for search purposes.

Peach :slight_smile:

[import]uid: 52491 topic_id: 18201 reply_id: 69647[/import]

Ok.ll keep in mind… [import]uid: 82446 topic_id: 18201 reply_id: 70131[/import]