views:

13

answers:

1

In flex, I am getting the y-coordinate in the following way:

nextHBox = HBox(ingBox.getChildByName("ing" + nextId));

nextYAxis = ingBox.localToGlobal(new Point(nextHBox.x,nextHBox.y)).y;

newCanvas.x = nextYAxis;

nextYAxis gives me the y-axis and I use it to position new component. It works absolutely fine. But, when there is vertical scroll, and I scroll it a little bit, and then the above mentioned code places the component at wrong place. I believe, it has something to do with the scroll.

+1  A: 

You can factor in the scroll position of the parent container by adding the value of its verticalScrollPosition property to your y position.

Wade Mueller
It makes sense :) ... how to access the application container? ( as I believe I need to access verticalScrollPosition property of Application container )
Application.application.verticalScrollPositionThanks