Solved

Scroll Bar gone awry

Posted on 2007-03-29
4
161 Views
Last Modified: 2010-04-03
I've got a scrolling text bar that I've used on several ocassions, but while I know THAT it works, I don't understand WHY it works. Consequently, when I introduce different dimensions of the track and the size of the track, I get what you see by going out to http://www.brucegust.com/Radio.html

The scroll button doesn't line up where it should and it travels beyond the track. I've included a link to the actual fla file. Any ninja out there who would be willing to show me where I need to make my changes will be honored with both points and praise.

Here's the zip file:

http://www.brucegust.com/Scrollbar.zip
0
Comment
Question by:brucegust
  • 3
4 Comments
 
LVL 23

Expert Comment

by:Zeffer
ID: 18821342
in the code on frame 1 make these 3 changes..

stop();
scrolling = function () {
var scrollHeight:Number = scrollTrack._height;
var contentHeight:Number = contentMain._height;
var scrollFaceHeight:Number = scrollFace._height;
var maskHeight:Number = maskedView._height;
var initPosition:Number = scrollFace._y=scrollTrack._y -33;   ////here
var initContentPos:Number = contentMain._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
var left:Number = scrollTrack._x;
var top:Number = scrollTrack._y - 33; ////here
var right:Number = scrollTrack._x;
var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y - 30; ////here
var dy:Number = 0;
var speed:Number = 10;
etc
etc

Z
0
 
LVL 23

Accepted Solution

by:
Zeffer earned 500 total points
ID: 18821362
on reviewing that I see stopping the knob exactly against the bottom stop..same as the top..doesn't show the last line of text properly..so change the last line  where I made changes ..to..
var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y - 25;
and move the stop down a little.

Z
0
 

Author Comment

by:brucegust
ID: 18823144
Zeffer, you have the points, my friend. Two questions, if you could indludge me...

First of all, why do your suggestions work? I tried a number of different things, but the way you were able to hone in on what precisely would make the difference compels me to ask what it is that you saw that told you, "Here is where the changes need to be made..."

Secondly, the code is below. The text still isn't revealed in it's entirety. You mentioned moving the "stop down a little..." What is that and where does that change need to occur?

Thanks!

stop();
scrolling = function () {
var scrollHeight:Number = scrollTrack._height;
var contentHeight:Number = contentMain._height;
var scrollFaceHeight:Number = scrollFace._height;
var maskHeight:Number = maskedView._height;
var initPosition:Number = scrollFace._y=scrollTrack._y-33;
var initContentPos:Number = contentMain._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos//here's a change;
var left:Number = scrollTrack._x;
var top:Number = scrollTrack._y-33;
var right:Number = scrollTrack._x;
var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y-30;
var dy:Number = 0;
var speed:Number = 10;
var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-scrollFaceHeight);
0
 
LVL 23

Expert Comment

by:Zeffer
ID: 18826171
well we know the knob (instance name scrollFace)slides up and down on the y axis
it was starting off 1/4 of the way down the slide track..so we change the 'initial position' by minus 33 pixels (up)
var initPosition:Number = scrollFace._y=scrollTrack._y-33;

the knob was travelling past the buttom of the track..so we change the point where it stops by minus 30 pixels
we know it's here we make the change...
var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y-30;
as it is preceded by the variables left, top, right.. (left,top,right.bottom)which define the position of the slider

and the final content position is a similar fix.

As dragging the knob or using the buttons are separate actions..it was not exactly right and I  lengthened the slide track a little and moved the bottom button down and made a couple of other mysterious changes (some numbers in the scrollface code) ;)

here it is all fixed..
http://www.redpearl.co.nz/ee/radio1.zip

Z
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now