rendered paste body_global.sBar = this;
//************************************************************************
//author: tri nugget
//site: http://www.midnightprojects.com
//title: mother of all scrollers
//what does it do: it positions, scales, slices and dices to the textbox
//************************************************************************
//************************************************************************
//initialize variables
init = function(textFieldName){
this.textFieldName =textFieldName
trace("init scroll bar"+textFieldName)
textX = Math.round(_parent[textFieldName]._x);
textY = Math.round(_parent[textFieldName]._y);
tWidth = Math.round(_parent[textFieldName]._width);
tHeight = Math.round(_parent[textFieldName]._height);
//this._y = textY + 1;
//this._x = textX + tWidth + 10;
//this._alpha = 0;
//scrollDown._y = tHeight - scrollDown._height - 1;
scrollArea._y = 0;
scrollArea._height = tHeight;
balkheight = scrollArea._height - scrollbar._height;
}
init();
//************************************************************************
checkScroll = function(){
myMax = _parent[textFieldName].maxscroll;
myScroll = _parent[textFieldName].scroll;
if (myMax <= myScroll){
fadeMe(sBar, {alpha:0, steps:15, meth:"easeInOutExpo", done:function(){
sBar._visible = false;
}});
} else {
sBar._visible = true;
fadeMe(sBar, {alpha:100, steps:15, meth:"easeInOutExpo"});
}
}
//************************************************************************
//scrollbar function
function scrollFun(obj, cmd){
if (curSelect != obj){
if (cmd != "select"){
obj.cmd=cmd;
obj.play();
}
else {
curSelect.cmd="out";
curSelect.play();
curSelect=obj;
curSelect.cmd="in";
curSelect.play();
}
}
}
//************************************************************************
//************************************************************************
//scrollButton function
function scrollMe(buttonPress, direction) {
if (direction == "up") {
scrollUp.onEnterFrame = function() {
if (buttonPress == true) {
currentScroll = _parent[textFieldName].scroll;
max = _parent[textFieldName].maxscroll;
if (Number(currentScroll) > 1) {
_parent[textFieldName].scroll = currentScroll - 1;
}
scrollbar.slider._y = (((_parent[textFieldName].scroll - 1) / (_parent[textFieldName].maxscroll)) * balkheight);
}
else {
scrollUp.onEnterFrame = null;
}
}
}
else {
scrollDown.onEnterFrame = function() {
if (buttonPress == true) {
currentScroll = _parent[textFieldName].scroll;
max = _parent[textFieldName].maxscroll;
if (Number(currentScroll) < Number(max)) {
_parent[textFieldName].scroll = Number(currentScroll) + 1;
}
scrollbar.slider._y = (((_parent[textFieldName].scroll + 1) / (_parent[textFieldName].maxscroll + 1)) * balkheight);
}
else {
scrollDown.onEnterFrame = null;
}
}
}
}
//************************************************************************
//************************************************************************
//scrollbar function
function scrollBarFun(scrollPress) {
this.onEnterFrame = function() {
if (scrollPress == true) {
scrollvalue = scrollbar.slider._y / balkheight;
max = _parent[textFieldName].maxscroll;
_parent[textFieldName].scroll = int(Number(scrollvalue * (max)));
}
else {
this.onEnterFrame = false;
}
}
}
//************************************************************************