I forgot something...true.
Change it to something like:

var scrollRatio = scrollBar.slider._y / scrollBar.scrollTrack._height;
var heightToScroll = currentChild._height -
currentChildContainerMask._height;
if(heightToScroll < 0) {
  heightToScroll = 0;
}
currentChild._y = - scrollRatio * heightToScroll;


Where currentChildContainerMask._ height is the height of the Mask that is
masking your currentChild, or simply the height of the outline that is
representing the visible area of your currentChild as its being scrolled.
So basically heightToScroll is equal to the height of your currentChild that
is invisible to the user, it's the part you want to be able to scroll for.

Hope that helps :)
Fredz./



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kent
Humphrey
Sent: October 29, 2005 1:27 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] scrolling problem


>> Now for your script, I don't usually go that way of doing it so here 
>> is how
>> I'd probably do it myself:
>>
>> var scrollRatio = scrollBar.slider._y / scrollBar.scrollTrack._height;
>> currentChild._y = - scrollRatio * currentChild._height;
>>
>> I'm not 100% sure but I think this should work. Notice the negative value
>> for the currentChild._y. 
> 
> 
> Thanks, I'll see how that behaves.

Well, it's giving me more consistant results across my different clips, but
it's 
scrolling too far, leaving whitespace at the bottom. Any ideas?

Logically, I think the scrollRatio must be too high, because it's scrolling 
further than it should.

I've added an offset because the top of the scrolling area is not the top of
the 
screen.

var offset = 108;
var scrollRatio = scrollBar.slider._y / scrollBar.track._height;
currentChild._y = (- scrollRatio * currentChild._height) + offset;

I'll write some code to make the offset dynamic later.

To see the script in action, go here - http://fari.kentandangela.com and
browse 
to Gallery -> Woodcarvings.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to