All,
I’m trying to create a dynamic scroll bar and I bought a template and am trying to get this to work. Here is the code for the dynamic scroll bar:
onClipEvent (load) {
oldY = 1;
Y = 1;
vY = 0;
newY = 0;
mouseWheelHitTest = true;
contentHeight = _parent.scrolledMC._height;
scrollSpeed = _parent.speed_content;
scrollStep = _parent.step_content;
viewHeight = _parent.line._height;
buttonSize = _parent.dragMC._height;
buttonY = buttonMC._y;
scrollHeight = _parent.scrolledMC._height;
scrollContent = _parent.scrolledMC._y;
scrollContent1 = _parent.scrolledMC;
newY = _parent.scrolledMC._height;
var mouseListener:Object = new Object();
mouseListener.onMouseWheel = function(delta) {
if (!mouseWheelHitTest || scrollContent1.hitTest(_root._xmouse, _root._ymouse, false) || hitTest(_root._xmouse, _root._ymouse, false)) {
if (buttonMC._y>=0 && buttonMC._y<=scrollHeight-buttonSize+1) {
buttonMC._y -= (delta)*_parent.mouse_speed;
}
}
};
Mouse.addListener(mouseListener);
hiScroll = _parent.line._height-_parent.dragMC._height;
step = ((scrollHeight-buttonSize)-(hiScroll))/(hiScroll);
y = _parent.scrolledMC._y;
}
onClipEvent (enterFrame) {
if (_parent.drag_but) {
if (buttonMC._y>=0) {
buttonMC._y -= scrollStep;
}
}
if (_parent.down_but) {
if (buttonMC._y<=scrollHeight+buttonSize) {
buttonMC._y += scrollStep;
}
}
if (buttonMC._y<=0) {
buttonMC._y = 0;
}
if (buttonMC._y>=viewHeight-buttonSize) {
buttonMC._y = viewHeight-buttonSize;
}
level = buttonMC._y-buttonY;
lev = int(y-(level*step));
newY = oldY+(lev-oldY)/scrollSpeed;
_parent.scrolledMC._y = newY;
oldY = newY;
}
My problem is that this scroll bar works great for static text. However when I have dynamic text and I intentionally put a lot of it in, the scroll bar stops based on the height of the text box and not necessarily the size of how much dynamic text I have. I think that it deals with one of these:
contentHeight = _parent.scrolledMC._height;
scrollHeight = _parent.scrolledMC._height;
scrollContent = _parent.scrolledMC._y;
scrollContent1 = _parent.scrolledMC;
newY = _parent.scrolledMC._height;
Within this movie clip, they also embed another layer which the content is actually loaded into. So the flow is the following:
pages_all -> action sc -> action content
So the content is in the last movie clip, but the code listed above is in the action sc movie clip. I’m just not sure how to edit this to get the dynamic content instead of a standard one.
Thanks for any help in advance!