so here is a working scroll bar. for text and images. script all included. problem cant find a way to set the ceiling height of the image that is being scrolled. any ideas, thoughts, or comments-
/////////////////////////////////////////////////////////////
// //
// KELdesigns Scrollbar Component by Keith Edward Leyson //
// [www.keldesigned.com](http://www.keldesigned.com) //
// [email="keith@keldesigned.com"]keith@keldesigned.com[/email] //
// //
/////////////////////////////////////////////////////////////
//Movieclip color changer prototype...
MovieClip.prototype.changeColor = function(MCTarget, newColor) {
mynewColor = new Color(MCTarget);
mynewColor.setRGB(newColor);
};
this.tabEnabled = false;
//Initialize targets (must be strings)...
targetMC = this._parent[this._targetInstanceName];
targetBorder = this.KEL_parentBorder;
originalHeight = this._height;
originalTargetY = targetMC._y;
changeColor(trackBar, this.KEL_trackColor);
//////////////////////////
//////////////////////////
/// ///
/// PUBLIC METHODS ///
/// ///
//////////////////////////
//////////////////////////
function scrollRefresh() {
if (this.KEL_scrollObject == "compile") {
scrollBar._y = trackBar._y;
targetMC._y = originalTargetY;
refreshScrollbar();
}
if (this.KEL_scrollObject == "Text") {
scrollBar._y = trackBar._y;
refreshScrollbarTF();
}
}
///////////////////////////
///////////////////////////
/// ///
/// PRIVATE METHODS ///
/// ///
///////////////////////////
///////////////////////////
//Disable scrollbar...
function scrollDisalbed() {
up.enabled = false;
down.enabled = false;
scrollBar.enabled = false;
trackBar.enabled = false;
scrollBar._y = trackBar._y;
scrollBar.dark._height = trackBar._height;
scrollBar.resize();
if (this.KEL_disabledState == "faded") {
this._alpha = 30;
} else if (this.KEL_disabledState == "invisible") {
this._visible = false;
} else if (this.KEL_disabledState == "buttons only") {
scrollBar._visible = false;
} else if (this.KEL_disabledState == "trackbar only") {
up._visible = false;
down._visible = false;
scrollBar._visible = false;
} else if (this.KEL_disabledState == "none") {
//nothing is set!
}
}
function refreshScrollbar() {
scrollBar.onEnterFrame = undefined;
targetAmount = targetMC._height-targetBorder;
scrollBarAmount = trackHeight-targetAmount/10;
ratio = targetBorder/targetMC._height;
scrollBar.dark._height = Math.round(trackBar._height*ratio);
if (scrollBar.dark._height<5) {
scrollBar.dark._height = 5;
}
this._alpha = 100;
this._visible = true;
if (!this.KEL_btn_arrows) {
up._visible = true;
down._visible = true;
up.enabled = true;
down.enabled = true;
}
if (!this.KEL_btn_scroller) {
scrollBar._visible = true;
scrollBar.enabled = true;
}
trackBar.enabled = true;
// Main content scrolling script...
Y = targetMC._height-targetBorder+((targetMC._y-this._y)*2)+this.KEL_easeSpace;
Y2 = targetMC._y;
// Content scrolling object...
scrollBar.onEnterFrame = function() {
scrAmt = Math.round((scrollBar._y-trackBar._y)/((trackBar._height-scrollBar._height)/Y));
// Toggle easing...
if (this._parent.KEL_easingAmount>=0 && this._parent.KEL_easingAmount<=6) {
easeAmt = this._parent.KEL_easingAmount;
} else {
easeAmt = 6;
}
if (!this._parent.KEL_scrolleasing) {
targetMC._y = (-scrAmt)+Y2;
} else if (this._parent.KEL_scrolleasing) {
easeY = (-scrAmt)+Y2;
targetMC._y += Math.round((easeY-targetMC._y)/easeAmt);
if (targetMC._y>=(easeY-1) && targetMC._y<=(easeY+1)) {
targetMC._y = easeY;
}
}
};
scrollBar.resize();
if (targetMC._height<=targetBorder) {
scrollDisalbed();
}
}
//scroll dynamic or input!
function scrollToBottomOnChange() {
trackExcessTop = trackBar._height-scrollBar._height;
scrollBar._y = trackExcessTop+trackBar._y;
}
function refreshScrollbarTF() {
targetAmount = targetMC.textHeight-targetBorder;
scrollBarAmount = trackHeight-targetAmount/10;
ratio = targetBorder/targetMC.textHeight;
scrollBar.dark._height = Math.round(trackBar._height*ratio);
if (scrollBar.dark._height<5) {
scrollBar.dark._height = 5;
}
this._alpha = 100;
this._visible = true;
if (!this.KEL_btn_arrows) {
up._visible = true;
down._visible = true;
up.enabled = true;
down.enabled = true;
}
if (!this.KEL_btn_scroller) {
scrollBar._visible = true;
scrollBar.enabled = true;
}
trackBar.enabled = true;
scrollBar.onEnterFrame = function() {
scrAmt = Math.round((scrollBar._y-trackBar._y)/((trackBar._height-scrollBar._height)/targetMC.maxscroll));
targetMC.scroll = scrAmt;
};
if (targetMC.textHeight<targetBorder) {
scrollDisalbed();
}
scrollBar.resize();
}
///////////////////////////////
///////////////////////////////
/// ///
/// EVENTS | INITIALIZE ///
/// ///
///////////////////////////////
///////////////////////////////
//Hand cursor settings...
up.useHandCursor = this.KEL_handMouse;
down.useHandCursor = this.KEL_handMouse;
scrollBar.useHandCursor = this.KEL_handMouse;
trackBar.useHandCursor = this.KEL_handMouse;
//Scrollbar repositioning...
if (this.KEL_autoSnap) {
this._y = Math.round(targetMC._y+this.KEL_offSetY);
this._x = Math.round(targetMC._x+targetMC._width+this.KEL_offSetX);
}
//Scalling Overide...
if (this._xscale != 100) {
this.KEL_SBWidth = this._width;
}
if (this._yscale != 100) {
targetBorder = this._height;
}
this._xscale = 100;
this._yscale = 100;
//Track bar and scrollbar set-up...
up.dark._width = this.KEL_SBWidth;
up.dark._height = this.KEL_SBWidth;
down.dark._width = this.KEL_SBWidth;
down.dark._height = this.KEL_SBWidth;
trackBar._width = this.KEL_SBWidth;
scrollBar.dark._width = this.KEL_SBWidth;
//Arrows ON/OFF...
trackHeight = targetBorder-(2*Number(this.KEL_SBWidth));
trackBar._y = this.KEL_SBWidth;
scrollBar._y = this.KEL_SBWidth;
if (this.KEL_btn_arrows) {
up._visible = false;
down._visible = false;
trackBar._y = 0;
scrollBar._y = 0;
trackHeight = targetBorder;
}
//Scrollbar ON/OFF...
if (this.KEL_btn_scroller) {
scrollBar._visible = false;
}
//Element placement...
trackBar._height = Math.round(trackHeight);
downArrowPos = trackBar._y+trackHeight;
down._y = Math.round(downArrowPos);
//trackBar calculations...
trackBar.onPress = function() {
this.onEnterFrame = function() {
distUp = scrollBar._y-(up._height+up._y);
distDown = down._y-(scrollBar._y+scrollBar._height);
if (_ymouse>scrollBar._y) {
if (distDown>=(this._parent.KEL_scrollAmount*ratio)) {
scrollBar._y = Math.round(scrollBar._y+(this._parent.KEL_scrollAmount*ratio));
} else {
scrollBar._y = scrollBar._y+distDown;
this.onEnterFrame = undefined;
}
}
if (_ymouse<scrollBar._y) {
if (distUp>=(this._parent.KEL_scrollAmount*ratio)) {
scrollBar._y = Math.round(scrollBar._y-(this._parent.KEL_scrollAmount*ratio));
} else {
scrollBar._y = trackBar._y;
this.onEnterFrame = undefined;
}
}
};
};
trackBar.onRelease = function() {
this.onEnterFrame = undefined;
};
trackBar.onReleaseOutside = trackBar.onRelease;
//Select which method to run...
if (this.KEL_scrollObject == "Movie Clip") {
refreshScrollbar();
}
if (this.KEL_scrollObject == "Text") {
refreshScrollbarTF();
targetMC.onChanged = function() {
refreshScrollbarTF();
if (targetMC.scroll == targetMC.maxscroll) {
scrollToBottomOnChange();
}
};
}
[color=black][font=Arial]i am willing to post the fla if someone says how to. this scroll bar could help out many if we work out kinks and label things correctly[/font][/color]