You can also use getBoundingClientRect() to get the coordinates from the browser window (as the parent). The above method using “offset” gets the coordinates from the Hype window (as the parent).
You can put offset to use to build a measuring tool.
var d = hypeDocument.getElementById("box");
var leftPos = d.offsetLeft;
hypeDocument.getElementById('coords').innerHTML = leftPos + " pixels";
In a new Hype doc insert a rectangle with an “id” named “box” and a text box with an “id” named “coords”. Use the Action Inspector to set the “On Drag” functions to “Control Element Position” and attach the javascript there too.
This topic is slightly old, but if you’re hoping to detect and act on element position, this is now a bit easier with the addition of Getter / Setter api functions in Hype 3.5: http://tumult.com/hype/documentation/3.0/#api-functions