Comunidad de diseño web y desarrollo en internet online

Scroll en Action Script

Citar            
MensajeEscrito el 03 Oct 2008 04:00 pm
Hola buenas tardes...tengo el siguiente problema..compré un action script para que hiciese un scroll de imagenes mediante una barra de desplazamiento y sus flechas laterales.

El problema que tengo es que quiero que al 'mantener pulsado' sobre la flecha derecha se desplace seguido hasta acabar de ver el nº de imagenes..y al contrario con la flecha izquierda.

Les posteo el codigo porque está hecho de una forma diferente y no la comprendo, gracias!

stop();
function imageSetHye1() {
this._x += (-(counter-1)*45+imageSet.defaultY-this._x)/4;
}
function imageSetHye2() {
this._x = -scrollSet.scrollBar._x/(scrollGapPoint-scrollBarWidth)*45*(numOfImage-1)+this.defaultY;
}
function scrollBarHye() {
var v3 = scrollGapPoint-scrollBarWidth;
var v2 = scrollStartPoint+(v3/(numOfImage-1));
var v1 = v2*(counter-1);
this.scrollBar._x += (v1-this.scrollBar._x)/4;
}
numOfImage = 8;
imageWidth = 160;
gap = 3000;

counter = 1;
scrollStartPoint = 0;
scrollEndPoint = 955;
scrollGapPoint = scrollEndPoint-scrollStartPoint;
scrollBarWidth = 139;
imageSet.defaultY = imageSet._x;
for (i=1; i<=numOfImage; i++) {
this[i].gotoAndStop(i);
imageSet["s"+i]._x = (i-1)*imageWidth;
imageSet["s"+i]._y = 0;
}
imageSet.onEnterFrame = imageSetHye1;
scrollSet.onEnterFrame = scrollBarHye;
interval = setInterval(fun1, gap);
var v0 = function () {
clearInterval(interval);
this.onEnterFrame = function() {
this.nextFrame();
};
};

scrollSet.rightBtn.onRollOver = v0;
scrollSet.leftBtn.onRollOver = v0;
var v0 = function () {
interval = setInterval(fun1, gap);
this.onEnterFrame = function() {
this.prevFrame();
};
};

scrollSet.rightBtn.onRollOut = v0;
scrollSet.leftBtn.onRollOut = v0;

scrollSet.leftBtn.onPress = function() {
if (counter>1) {
counter--;
}
};
scrollSet.rightBtn.onPress = function() {
if (numOfImage>counter) {
counter++;
};
};
scrollSet.rightBtn.onRelease= function() {
if (numOfImage>counter) {
counter++;
};
}
scrollSet.scrollBar.onPress = function() {
scrollSet.onEnterFrame = null;
imageSet.onEnterFrame = imageSetHye2;
this.startDrag(false,scrollStartPoint,0,scrollEndPoint-scrollBarWidth,0);
};

scrollSet.scrollBar.onRelease = function() {
v3 = scrollGapPoint-scrollBarWidth;
v2 = v3/(numOfImage-1);
v1 = Math.round((this._x-scrollStartPoint)/v2)+1;
counter = v1;
scrollSet.onEnterFrame = scrollBarHye;
imageSet.onEnterFrame = imageSetHye1;
this.stopDrag();
};
scrollSet.scrollBar.onDragOut = function() {
v3 = scrollGapPoint-scrollBarWidth;
v2 = v3/(numOfImage-1);
v1 = Math.round((this._x-scrollStartPoint)/v2)+1;
counter = v1;
scrollSet.onEnterFrame = scrollBarHye;
imageSet.onEnterFrame = imageSetHye1;
this.stopDrag();
};

Sé que es un poco rollo..pero el que lo solucione le daré el archa poder ejecutarlo!

Mil gracias!

Por jvhdesign

3 de clabLevel



 

msie
Citar            
MensajeEscrito el 03 Oct 2008 06:28 pm

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 04 Oct 2008 05:14 am
Ups! lo siento..ahi va el código:

Código :

stop();
function imageSetHye1() {
   this._x += (-(counter-1)*25+imageSet.defaultY-this._x)/4;
}
function imageSetHye2() {
   this._x = -scrollSet.scrollBar._x/(scrollGapPoint-scrollBarWidth)*25*(numOfImage-1)+this.defaultY;
}
function scrollBarHye() {
   var v3 = scrollGapPoint-scrollBarWidth;
   var v2 = scrollStartPoint+(v3/(numOfImage-1));
   var v1 = v2*(counter-1);
   this.scrollBar._x += (v1-this.scrollBar._x)/4;
}
numOfImage = 7;
imageWidth = 160;
gap = 3000;

counter = 1;
scrollStartPoint = 0;
scrollEndPoint = 955;
scrollGapPoint = scrollEndPoint-scrollStartPoint;
scrollBarWidth = 139;
imageSet.defaultY = imageSet._x;
for (i=1; i<=numOfImage; i++) {
   this[i].gotoAndStop(i);
   imageSet["s"+i]._x = (i-1)*imageWidth;
   imageSet["s"+i]._y = 0;
}
imageSet.onEnterFrame = imageSetHye1;
scrollSet.onEnterFrame = scrollBarHye;
interval = setInterval(fun1, gap);
var v0 = function () {
clearInterval(interval);
this.onEnterFrame = function() {
this.nextFrame();
};
};

scrollSet.rightBtn.onRollOver = v0;
scrollSet.leftBtn.onRollOver = v0;
var v0 = function () {
interval = setInterval(fun1, gap);
this.onEnterFrame = function() {
this.prevFrame();
};
};

scrollSet.rightBtn.onRollOut = v0;
scrollSet.leftBtn.onRollOut = v0;
scrollSet.leftBtn.onRelease = function() {
   if (counter>1) {
      counter--;
   }
};

scrollSet.rightBtn.onRelease = function() {
   if (numOfImage>counter) {
                   counter++;
   }
};

scrollSet.scrollBar.onRollOver = function() {
   clearInterval(interval);
   this.onEnterFrame = function() {
      this.nextFrame();
   };

};

scrollSet.scrollBar.onRollOut = function() {
   interval = setInterval(fun1, gap);
   this.onEnterFrame = function() {
      this.prevFrame();
   };

};

scrollSet.scrollBar.onPress = function() {
   scrollSet.onEnterFrame = null;
   imageSet.onEnterFrame = imageSetHye2;
   this.startDrag(false,scrollStartPoint,0,scrollEndPoint-scrollBarWidth,0);
};

scrollSet.scrollBar.onRelease = function() {
   v3 = scrollGapPoint-scrollBarWidth;
   v2 = v3/(numOfImage-1);
   v1 = Math.round((this._x-scrollStartPoint)/v2)+1;
   counter = v1;
   scrollSet.onEnterFrame = scrollBarHye;
   imageSet.onEnterFrame = imageSetHye1;
   this.stopDrag();
};
scrollSet.scrollBar.onDragOut = function() {
   v3 = scrollGapPoint-scrollBarWidth;
   v2 = v3/(numOfImage-1);
   v1 = Math.round((this._x-scrollStartPoint)/v2)+1;
   counter = v1;
   scrollSet.onEnterFrame = scrollBarHye;
   imageSet.onEnterFrame = imageSetHye1;
   this.stopDrag();
};


A ver si alguien dá con ello!

Por jvhdesign

3 de clabLevel



 

msie

 

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