Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/07/2009, 10:55
matuke10
 
Fecha de Ingreso: junio-2009
Mensajes: 2
Antigüedad: 14 años, 10 meses
Puntos: 0
Scroll que carga texto externo

Hola a todos. Tengo un scroll (bajado de la web hace un tiempo) que funciona perfecto, al cual (no se si del todo bien) le sume la propiedad de que cargue el contenido desde un archivo de txt externo (un txt simple). Hasta aqui funciona perfecto, el inconveniente es que la barra de scroll y los botones para subir y bajar el scroll no se adaptan a la cantidad del texto externo, es decir, scrolea pero hasta un cierto punto, dejando texto por leer.
Si alguien puede ayudarme seria de gran ayuda!

Como no se como adjuntar el FLA aqui, les pego el codigo que tengo (insisto, no soy para nada experto, mis disculpas).

Encontre los siguiente en un keyframe solo de action dice:
step = 4;
speed = 15;
scroll_bg._height = _root.scrHEIGHT;
down._y = scroll_bg._height;
this.loadVariables("texto.txt"); // esta ultima la agregue yo


Y la barra de scroll tiene el siguiente:

onClipEvent(load)
{
buttonSize = 0;
viewHeight = _parent.scroll_bg._height;
viewWidth = _parent.scroll_bg._x;
scrollContent = _parent.for_text;
heightCorect = false;
mouseWheelHitTest = true;
wheelStep = 5;
pageStep = 10;
pageStep2 = 10;
pageDelay = 200;
arroyStep = 10;
arroyStep2 = 0.5;
arroyDelay = 3;
speedDec = 0.65;
scrollStep = _parent.speed;
_x = scrollContent._x + viewWidth;
_y = scrollContent._y;
dragButtonIsDraging = false;
scrollPos = 0;
upButton._y = 0;
pageUpButton._x = 0;
pageDownButton._x = 0;
contentHeight = heightCorect ? scrollContent.height : scrollContent._height;
scrollHeight = viewHeight - buttonSize * 2;
dragButtonHeight = viewHeight >= contentHeight ? scrollHeight : viewHeight * scrollHeight / contentHeight;
dragButton._yscale = dragButtonHeight;
dragButton._y = buttonSize;
downButton._y = buttonSize + scrollHeight;
blanckDown._y = downButton._y;
blanckUp._x = 0;
blanckUp._y = 0;
blanck._x = 0;
blanck._y = buttonSize;
blanckDown._x = 0;
pageUpButton._y = buttonSize;
blanck._height = scrollHeight;
blanckUp._visible = viewHeight >= contentHeight ? true : false;
blanck._visible = viewHeight >= contentHeight ? true : false;
blanckDown._visible = viewHeight >= contentHeight ? true : false;
upButton._visible = viewHeight >= contentHeight ? false : true;
dragButton._visible = viewHeight >= contentHeight ? false : true;
downButton._visible = viewHeight >= contentHeight ? false : true;
_parent.drag._visible = viewHeight >= contentHeight ? false : true;
_parent.down._visible = viewHeight >= contentHeight ? false : true;
if (viewHeight > contentHeight)
{
_parent.for_text._x = _parent.for_text._x + 5;
}

mouseListener = new Object();
mouseListener.onMouseWheel = function (delta)
{
if (!mouseWheelHitTest || scrollContent.hitTest(_root._xmouse, _root._ymouse, false) || hitTest(_root._xmouse, _root._ymouse, false))
{
dragButton._y = dragButton._y - delta * wheelStep;
if (dragButton._y < buttonSize)
{
dragButton._y = buttonSize;
}

if (dragButton._y > buttonSize + scrollHeight - dragButtonHeight)
{
dragButton._y = buttonSize + scrollHeight - dragButtonHeight;
}

}

}
;
Mouse.addListener(mouseListener);
curY = 0 - scrollContent._y;
vY = 0;
mask = scrollContent._parent.createEmptyMovieClip("mask", scrollContent._parent.getNextHighestDepth());
with (mask)
{
beginFill(255, 50);
lineStyle(0, 16711935, 100);
moveTo(scrollContent._x - 1000, scrollContent._y);
lineTo(scrollContent._x + 1000 + viewWidth, scrollContent._y);
lineTo(scrollContent._x + 1000 + viewWidth, scrollContent._y + viewHeight);
lineTo(scrollContent._x - 1000, scrollContent._y + viewHeight);
endFill();
}

scrollContent.setMask(mask);
}

onClipEvent(enterFrame)
{
blanckUp._visible = viewHeight >= contentHeight ? true : false;
blanck._visible = viewHeight >= contentHeight ? true : false;
blanckDown._visible = viewHeight >= contentHeight ? true : false;
upButton._visible = viewHeight >= contentHeight ? false : true;
dragButton._visible = viewHeight >= contentHeight ? false : true;
downButton._visible = viewHeight >= contentHeight ? false : true;
_parent.drag._visible = viewHeight >= contentHeight ? false : true;
_parent.down._visible = viewHeight >= contentHeight ? false : true;
_parent.scroll_bg._visible = viewHeight >= contentHeight ? false : true;
if (incDelay < 0)
{
dragButton._y = dragButton._y - inc;
if (dragButton._y < buttonSize)
{
dragButton._y = buttonSize;
}

if (dragButton._y > buttonSize + scrollHeight - dragButtonHeight)
{
dragButton._y = buttonSize + scrollHeight - dragButtonHeight;
}

}

--incDelay;
contentHeight = heightCorect ? scrollContent.height : scrollContent._height;
scrollHeight = viewHeight - buttonSize * 2;
dragButtonHeight = viewHeight >= contentHeight ? scrollHeight : viewHeight * scrollHeight / contentHeight;
dragButton._yscale = dragButtonHeight;
downButton._y = buttonSize + scrollHeight;
pageDownButton._y = dragButton._y + dragButtonHeight;
pageDownButton._yscale = scrollHeight - dragButtonHeight - dragButton._y + buttonSize - scrollPos;
pageUpButton._yscale = dragButton._y - buttonSize;
!dragButtonIsDraging;
if (dragButton._y > buttonSize + scrollHeight - dragButtonHeight)
{
dragButton._y = buttonSize + scrollHeight - dragButtonHeight;
}

newY = (dragButton._y - buttonSize) / dragButtonHeight * viewHeight;
vY = vY + (curY - newY) / scrollStep;
vY = vY * speedDec;
curY = curY - vY;
scrollContent._y = Math.floor(0 - curY + _y);
}

onClipEvent(enterFrame)
{
if (_parent.down_but == true)
{
with (_parent.scroll)
{
if (dragButton._y < buttonSize + scrollHeight - dragButtonHeight - _parent.step)
{
dragButton._y = dragButton._y + _parent.step;
}
else
{
dragButton._y = buttonSize + scrollHeight - dragButtonHeight;
}


}

}

if (_parent.drag_but == true)
{
if (_parent.scroll.dragButton._y > _parent.step)
{
_parent.scroll.dragButton._y = _parent.scroll.dragButton._y - _parent.step;
}
else
{
_parent.scroll.dragButton._y = 0;
}


}

}

Despues no encontre nada mas de scripts.
Desde ya gracias! y disculpas por mi ignorancia!
Saludos
Matuke