Comunidad de diseño web y desarrollo en internet online

ayuda scroll

Citar            
MensajeEscrito el 08 May 2007 04:01 am
estaba viendo este scroll
http://www.cristalab.com/foros/viewtopic.php?t=30494
que está muy bueno y es re útil, mi pregunta está destinasa a si se puede con ese mismo código que además del texto también se puedan desplazar movieclips.
Eso es todo espero haber sido claro, desde ya muchas gracias!!

SALUDOS!

Por matiasnicolas

58 de clabLevel



Genero:Masculino  

mozilla
Citar            
MensajeEscrito el 08 May 2007 02:27 pm
El codigo que mencionas solo se puede usar para textos, pero yo he hecho un scrollbar que te puede servir para cualquier movieclip, no importa lo que contenga el Clip, si texto o imagenes, o animaciones:

aqui tienes el codigo:

Código :

//----------------------------------------------------------------
// declarar variables
//----------------------------------------------------------------
// _global.ImgScroll debe contener la instancia del movieclip a scrollear
AreaScroll = Bar._height - BtnPos._height;
IncScroll = (_global.ImgScroll._height - Bar._height) / AreaScroll;
if (IncScroll < 0) IncScroll = 0;
_global.swScroll = false;
BtnPos.Top = BtnPos._y;
BtnPos.Bottom = BtnPos._y + AreaScroll;
//----------------------------------------------------------------
// creación de mascara
//----------------------------------------------------------------
_global.objMascara = this._parent.createEmptyMovieClip("MascaraScroll", 1);
_global.objMascara.lineStyle(1, 0x000000);
_global.objMascara.beginFill(0x000000);
_global.objMascara.moveTo(0, 0);
_global.objMascara.lineTo(_global.ImgScroll._width, 0);
_global.objMascara.lineTo(_global.ImgScroll._width, Bar._height);
_global.objMascara.lineTo(0, Bar._height);
_global.objMascara.lineTo(0, 0);
_global.objMascara._x = _global.ImgScroll._x;
_global.objMascara._y = _global.ImgScroll._y;
_global.ImgScroll.setMask(objMascara);
//*******************************************************************
BtnPos.onPress = function() {
   _global.swScroll = true;
   this.startDrag(false,this._x, this.Top,this._x, this.Bottom);
}
//*******************************************************************
BtnPos.onRelease = BtnPos.onReleaseOutside = function() {
   this.stopDrag();
   _global.swScroll = false;
}
//*******************************************************************
this.onEnterFrame = function() {
//   trace("entro a scroll");
   if (!_global.swScroll) return;
   if (_global.ImgScroll._height < Bar._height) return;

   IncScroll = (_global.ImgScroll._height - Bar._height) / AreaScroll;
   if (IncScroll < 0) IncScroll = 0;
   
   PosAct = BtnPos._y - BtnPos.Top;
   _global.ImgScroll._y = this._y - (PosAct * IncScroll);
   trace(_global.ImgScroll._name + "PosY=" + _global.ImgScroll._y);
   trace(PosAct * IncScroll);
}


escribeme y te mando el FLA con el ejemplo.

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7
Citar            
MensajeEscrito el 09 May 2007 03:08 am
excelente!!! lo que si te agradeceria que me mandes el .fla porque todavia no estoy muy dentro de lo que es actionscript, por ello me gustaria que me lo mandes, si puede ser por aca si no a mi mail, [email protected]

saludos y muchas gracias!!!

Por matiasnicolas

58 de clabLevel



Genero:Masculino  

mozilla

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.