PDA

View Full Version : Using paragraph scrollbar as slider



yosik
02-06-2004, 06:01 AM
Hi,
The slider plugin beeing soooo standard, I thought about using the paragraph scrollbar as a slider.
I am trying to get scrollbar position, as compared to scrollbar range to be able to get a percentage slider and use it to control another object (video, flash etc..).
I am trying..but not succeeding.
The idea was to do the following:

scrollrange = Paragraph.GetScrollRange("Paragraph1", false);
scrollpos = Paragraph.GetPos("Paragraph1");
framenumber=scollpos/(scrollrange[2]-scrollrange[1]);
Flash.Seek("3D", SEEK_SPECIFIC, framenumber);

Furthermore, let's say that I could do that (with your help, please..), how can I get a realtime response? I can only put this set of actions in a onClick or onEnter event. How can I constantly read the scrollbar position?

Thanks
Yossi

Lorne
02-06-2004, 09:59 AM
Try one of these:

framenumber = total_frames * scrollpos / scrollrange

framenumber = total_frames * scrollpos / scrollrange + 1


Nice idea btw. :)

Corey
02-06-2004, 10:07 AM
That's a dang good idea, it's downright Yosstastic!

*Edit* Actually I like this one so much that I am going to do something I've never, ever done before, I'm going to post a golden thumb.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

kpsmith
02-06-2004, 11:45 AM
Now why didn't I think of that when I did the Image Slider Project (http://www.indigorose.com/forums/showthread.php?s=&threadid=5903) . Didn't realize I could control the scrollbar like that...

Guess I need to go back and RTFM again.

TJ_Tigger
02-06-2004, 01:38 PM
Yosstastic. I will have to remember that one.

Lorne
02-06-2004, 02:02 PM
Originally posted by yosik
Furthermore, let's say that I could do that (with your help, please..), how can I get a realtime response? I can only put this set of actions in a onClick or onEnter event. How can I constantly read the scrollbar position? The page's On Timer event should do the trick.

Lorne
02-06-2004, 02:19 PM
It works. :)

Here's a quick example project.

Note that the slider's range is controlled by the number of lines of text in the paragraph object.

You'll probably want to tweak the calculations so it reaches 100% when the slider is at the end, but I'll leave that as an exercise for someone with more time on their hands. :)

yosik
02-07-2004, 03:09 PM
Ok guys,
Thanks for the kudos.
I like yosstastic too :-)
Am outta office, but will try it first thing monday.
I LOVE this forum!!
Yossi