Position finder

I think it would be like too cool if the screen would show you the coordinates of your cursor (like in photoshop, illustrator, etc.) so you don't have to do any guessing as to where you want your objects to be.

there is... but in which application?

if you want it in your own app, use this

1
2
3
4
5
 local function onTouch(event)
  print(event.x, event.y)
 end
 
 Runtime:addEventListener("touch",onTouch)

@k96

Using the JayantV`s tip is one way.

But if you run his chunk it will give you an error about the event.

To fix this error, just use the following fixed code:

1
2
3
4
5
6
7
local function onTouch(event)
 
print("POS.X = " .. event.x, "POS.Y = ".. event.y)
 
end
 
Runtime:addEventListener("touch",onTouch)

Aw, man!!!! I never even thought about making a function!!!

Much appreciated,
J.C.

views:1381 update:2011/11/2 21:34:51
corona forums © 2003-2011