A screen shot of one of the cards in the LiveCode app that I'm working appears below. The user is able to click on the icons and move them about the screen, ideally to rank order them using the boxes to the right. In order to record the ranking of the icons, I'd like to get their y-coordinates -- that is, the higher the y-coordinate value, the lower the ranking. I'm stumped on how pass the coordinates of the images to a variable, though. I'm fairly new to LiveCode, so any help is much appreciated.rating_screenshot
Welcome to LiveCode!
In LiveCode you have an attribute:
the loc of image ”imagename”
which you can pass as a variable to a procedure. That will contain both x and y of your image (or any control) separated by comma. To get just the y you need to get the second item of that. So you can either grab that in your procedure or directly when you pass it. Let’s say you have a procedure called saveOrder
where you in some way save your data. The you can call that with the y-coordinate like:
saveOrder item 2 of the loc of image “imagename”
If you just want to grab something to determine which image is higher than the other you can instead use the top
or the bottom
instead of item 2 of the loc
. Look them up in the dictionary for further explanations...
PS the loc
is short for the location
and of course you can write it out if you prefer it