PDA

View Full Version : Y-position of a listitem in a scrolled list.


cayres
03-10-2008, 08:27 AM
Hi,
I have a scrollable list, with more items than shownitems, so we have a scrollbar. So far so good. When the user clicks an item in the list I'd like to display a little dropdown list of options at the position of the clicked item. I'm doing this in the onclick handler for the replicated textlistitem. This works fine if the list has not been scrolled - the 'y' value of the textlistitem gives its position on the screen. However if the list has been scrolled, the y-value of the textlistitem is its distance from the top of the list - a value that can be much greater than the height of the list and of the canvas. And the y-position of the parent (i.e. the list itself) is still zero. Is there a way to determine the actual position of a listitem relative to the -visible- part of the list? Thanks in advance,
Charles

kampfkolosso
03-10-2008, 08:59 AM
Hi cayres,
i'm not exactly sure what your problem is, but i think you need the position of the click relative to the main canvas. So you have to recalculate your position:
i've no straight-forward answer, but i would look at getAttributeRelative() of the view class or maybe some AS functions that can determine coordinates in other referencespaces.

Good luck and regards!

cayres
03-10-2008, 09:26 AM
That was just what was needed - this.getAttributeRelative('y',parent) provided the apparent position of the listitem on the screen. I appreciate your help.
Charles
:)