Happy to hear you solved your problems, including the height of your slider
was essential too :) Happy you spotted that one yourself! :D

Now the arrow, what you're saying is the simplest way. 

Something that might be interesting for you to try to implement is to have
the scrollContent update its position in an onEnterFrame instead of using an
onMouseMove, if that is what you're doing at the moment. Using onEnterFrame
will obviously include a little delay in your scrolled content, but it will
lighten up your CPU usage if what you are scrolling is huge and heavy (Don't
forget to call onEnterFrame() just before assigning it back to null). 

So what I would say is create a function called updateContent which will
have the math's you already have. And make sure to set the onEnterFrame when
the user is scrolling and assign it back to null when the user is finished
scrolling. When you use the arrows, simply move the slider by the height of
your slider or so, with some validations and call the updateContent method
:)

You're on the right path :)




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

Frédéric v. Bochmann wrote:
> 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./

Cool, that's working properly now.
        
var offset = 108;
var scrollRatio = scrollBar.slider._y / (scrollBar.track._height-30);
        
var heightToScroll = currentChild._height - whichMask._height;
if(heightToScroll < 0) {
        heightToScroll = 0;
}
currentChild._y = (- scrollRatio * heightToScroll) +offset;

the (scrollBar.track._height-30) is because the slider is 30 tall, and so it

never goes beyond scrollBar.track._height-30. The slider is non-proportional
at 
the moment.

I was thinking it wasn't working, until I realised that I was cheating with
the 
height of the mask, and hiding it behind a solid white block at the bottom
of 
the screen! <guilty look>

Once I've got that sorted, I just need to make the slider move when I click
on 
the arrows. What is the best way to do that? Make the arrows move the
slider, 
and then update the content as before?

Thanks for all your help :>
_______________________________________________
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