Hola!

Tengo un problema con un scroll que utilizo. De normal acoplo la longitud del texto a la longitud de la barra, pero ya estoy cansado de tenr que amoldarme yo a él.
Lo único que he conseguido es poder limitar la longitud a la mitad, una tercera parte, una cuarta...

Pero no amoldarlo a mis verdaderas necesidades. Si alguien me ayudase le estaría muy agradecido. Un saludo!


en la linea 32 encontré esto, pudiendo modificar solo en fracciones la longitud del scroll. He intentado con decimales, pero no funciona. jejeej. Supongo que se ve mi profundo desconocimiento de programación.

Código :

TH = track.body._height/2;


El codigo del primer frame es este:

Código :

function moveUnit(num)
{
    if (num > 0)
    {
        if (currentPer + v * num < 100)
        {
            moveContents(currentPer = currentPer + v * num);
            moveScrollBar(currentPer = currentPer + v * num);
        }
        else
        {
            moveContents(100);
            moveScrollBar(100);
            delete this["onEnterFrame"];
        } // end if
    }
    else if (currentPer + v * num > 0)
    {
        moveContents(currentPer = currentPer + v * num);
        moveScrollBar(currentPer = currentPer + v * num);
    }
    else
    {
        moveContents(0);
        moveScrollBar(0);
        delete this["onEnterFrame"];
    } // end if
} // End of the function
currentPer = 0;
MH = mask._height;
CH = contents._height;
TH = track.body._height/2;   
ratio = MH / CH * TH;
scrollBar.body._height = ratio;
SH = scrollBar.body._height;
scrollBar.bottom._y = SH;
v = ratio / 100;
contents.xMin = contents._x;
contents.yMin = contents._y;
contents.xMax = contents._x;
contents.yMax = contents._y - (CH - MH);
scrollBar.xMin = scrollBar._x;
scrollBar.yMin = scrollBar._y;
scrollBar.xMax = scrollBar._x;
scrollBar.yMax = scrollBar._y + TH - SH;
scrollBar.onPress = function ()
{
    this.startDrag(false, this.xMin, this.yMin, this.xMax, this.yMax);
    this.onMouseMove = function ()
    {
        this.dis = Math.round((this._y - this.yMin) / (this.yMax - this.yMin) * 100);
        moveContents(this.dis);
    };
};
scrollBar.onRelease = scrollBar.onReleaseOutside = function ()
{
    delete this["onMouseMove"];
    this.stopDrag();
};
bt_next.onPress = function ()
{
    this.onEnterFrame = function ()
    {
        moveUnit(1);
    };
};
bt_next.onRelease = function ()
{
    delete this["onEnterFrame"];
};
bt_prev.onPress = function ()
{
    this.onEnterFrame = function ()
    {
        moveUnit(-1);
    };
};
bt_prev.onRelease = function ()
{
    delete this["onEnterFrame"];
};
moveScrollBar = function (num)
{
    scrollBar.onEnterFrame = function ()
    {
        this._y = this._y + (this.yMin + (this.yMax - this.yMin) * num / 100 - this._y) * 0.200000;
        if (Math.abs(this.yMin + (this.yMax - this.yMin) * num / 100 - this._y) < 1)
        {
            this._y = this.yMin + (this.yMax - this.yMin) * num / 100;
            delete this["onEnterFrame"];
        } // end if
    };
};
moveContents = function (num)
{
    contents.onEnterFrame = function ()
    {
        this._y = this._y + (this.yMin + (this.yMax - this.yMin) * num / 103 - this._y) * 0.200000;
        if (Math.abs(this.yMin + (this.yMax - this.yMin) * num / 103 - this._y) < 1)
        {
            this._y = this.yMin + (this.yMax - this.yMin) * num / 103;
            currentPer = num;
            delete this["onEnterFrame"];
        } // end if
    };
};
if (MH < CH)
{
    wheel = new Object();
    wheel.onMouseWheel = function (w)
    {
        moveUnit(w * -1);
    };
    Mouse.addListener(wheel);
}
else
{
    scrollBar._visible = false;
    bt_prev._alpha = 30;
    bt_next._alpha = 30;
    delete scrollBar["onPress"];
    delete scrollBar["onRelease"];
    delete bt_next["onPress"];
    delete bt_next["onRelease"];
    delete bt_prev["onPress"];
    delete bt_prev["onRelease"];
} // end if