I spend almost 3 hours trying to figure this out, hope someone can help me.
I have a a set up like this:
ScrollPane > Sprite > multiple Loader one after another along y coordinate > external swf.
- The setup is to allow scrolling of the loader/swf vertically.
- All the objects have unit scale (no scale) except for Sprite which may have a scale factor due to zoom.
- The external swf are pages from a PDF, one page per swf.
All is good so far.
Now, I have a set of next and back navigation button to step through the pages. The problem is I cannot find the correct formula to calculate the ScrollPane.verticalScrollPosition to set to.
Can you spot the mistake here? Thanks..开发者_如何学编程.
scroll_per_height = scrollpane.maxVerticalScrollPosition / (sprite.height - scrollpane.height);
height_per_page = sprite.height / sprite.loaders.Count
scroll_position = (page - 1) * height_per_page * scroll_per_height;
Usually I just delete my question if i find out the answer before anyone replies. But I think this will help some people at least:
The verticalScrollPosition is not the scrollbar's scroller position, instead, it's actually the y-coordinate offset of the scrollpane.content
精彩评论