Re: [Flashcoders] scrolling problem

2005-10-29 Thread Kent Humphrey

Frédéric v. Bochmann wrote:

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 :)


Thanks for that, I will be trying to implement the above tomorrow afternoon. 
With luck you wont hear from me ;>

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] scrolling problem

2005-10-29 Thread Frédéric v . Bochmann
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! 

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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] scrolling problem

2005-10-29 Thread Kent Humphrey

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! 


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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] scrolling problem

2005-10-29 Thread Frédéric v . Bochmann
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] scrolling problem

2005-10-29 Thread Kent Humphrey


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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] scrolling problem

2005-10-29 Thread Kent Humphrey

Frédéric v. Bochmann wrote:

"As you can see I've currently got the slider clip as a child of the
scrollBar clip - should I bring it out to the same level?"

On that matter, I would say, look carefully at your line of code that
follows: (scrollBar._height - scrollBar.slider._y)

If the slider is scrolled higher than _y = 0 or that the slider goes lower
than scrollBar._height your slider will influence the scrollBar._height
value. This can be quite dangerous for weird acting script, but if your sure
your slider won't ever influence it's containers height, your Ok.


I have the slider being constrained by the startDrag function to be within the 
scrollBar clip at all times, so it should be ok.



What I might suggest you would be to use the scrollBar.scrollTrack._height
that might be existent or not in your scrollBar movieclip. 


Yes, it is, I'll try that.


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.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] scrolling problem

2005-10-29 Thread Frédéric v . Bochmann
"As you can see I've currently got the slider clip as a child of the
scrollBar clip - should I bring it out to the same level?"

On that matter, I would say, look carefully at your line of code that
follows: (scrollBar._height - scrollBar.slider._y)

If the slider is scrolled higher than _y = 0 or that the slider goes lower
than scrollBar._height your slider will influence the scrollBar._height
value. This can be quite dangerous for weird acting script, but if your sure
your slider won't ever influence it's containers height, your Ok.
What I might suggest you would be to use the scrollBar.scrollTrack._height
that might be existent or not in your scrollBar movieclip. 

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. 

Fredz./

 




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

Can someone help me with this code?

I'm trying to figure out how to scroll an MC up and down based on the
position 
of a scrollbar.

What am I doing wrong with this code?
I'm finding the ratio between how tall the content is (currentChild) and how

tall the scrollbar is:

scrollRatio = currentChild._height/scrollBar._height;

Then changing the position of the content depending on where the 
scrollBar.slider is:

currentChild._y = (scrollBar._height - scrollBar.slider._y)*scrollRatio;

The result of this is the content is not visible until the scrollbar slider
is 
most of the way down it's length, and then the content doesn't scroll far
enough.

As you can see I've currently got the slider clip as a child of the
scrollBar 
clip - should I bring it out to the same level?

Anyone got any ideas?

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders