Solved

Scroll Bar gone awry

Posted on 2007-03-29
4
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
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.

752 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