views:

10

answers:

0

Hi.

I've got a bit of a problem with functionality that I want to achieve. In my application I have Canvas container with verticalScrollPolicy set to on. Inside the Canvas I have multiple components that user can drag within the Canvas boundaries. When user clicks on any component, it gets selected and semi-transparent box appears behind it indicating that component it wraps is selected. Additionally two arrows appear outside of the Canvas also for the case of pointing selected component. It looks like this:

alt text

As you can see component that has 'kampania email ą' written on it is selected in this case. I'm updating coordinates of selection box and arrows each time y coordinate or height of the component change. I do the same thing when user scrolls inside the Canvas and here's where may problem is. Arrows are updated based on the result of code below:

var contentY:Number = (_selected.parent as UIComponent).contentToLocal(
    new Point(0, _selected.y)).y;
leftTriangle.y = contentY + _selected.height/2 - leftTriangle.height/2;

Unfortunately at the time I catch scroll event from the Canvas and try to handle it, contentY is still evaluated using component content y coordinate from before the scrolling. Is any way that doesn't involve calling multiple callLater functions in a row to wait for appropriate content coordinates values to appear?

Thanks.