If you do it right, it'll work just fine. You need to (a) consider display.height -1 since you are working in pixel coordinates and (b) may want to take the changing size of the object into account, i.e., use some more elementary math.