Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top