Comunidad de diseño web y desarrollo en internet online

slider

Citar            
MensajeEscrito el 03 Sep 2008 05:54 pm
lo q tengo es un slider en un menu q al pasar por ensima de un boton este slider se corre hacia ese boton

lo tengo armado de la siguiente manera.

en un fotograma un mc (slider_mc) tengo mi slider ( n.intancia: slider)

en otro fotograma los botones (button_1 , button_2 , button_3)

y las acciones en otro fotograma.

Código :

easeSpeed = 5;
//slider_mc is your Movie Clip's name, not the Instance Name.
slider_mc.onEnterFrame = function() {
   this._x += (xMove1-this._x)/easeSpeed;
};
button_1.onPress = function() {
   xMove = button_1._x;
};
button_2.onPress = function() {
   xMove = button_2._x;
};
button_3.onPress = function() {
   xMove = button_3._x;
};
button_4.onPress = function() {
   xMove = button_4._x;
};


lo q queria saber como hacer para q al clikear un boton este slider valla hasta alli y al pasar por otro boton el slider corra hasta ese boton, pero si no hago click vuelva al boton donde estaba antes. q accion deberia poner?.

saludos

Por Rakin

Claber

140 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Sep 2008 07:59 pm
Guarda un backup de la variable "xMove1" que tenías anteriormente:

Código ActionScript :

var easeSpeed:Number = 5;
var xMove:Number;
var xMoveBack:Number;
//slider_mc is your Movie Clip's name, not the Instance Name.

slider_mc.onEnterFrame = function():Void{
   this._x += (xMove-this._x)/easeSpeed;
};

//---Acciones de los botones

for(var i:Number = 1; i <= 4; i++){

   this["button_" + i].onPress = function():Void{
      xMove = this._x;
      xMoveBack = this._x;
   }

   this["button_" + i].onRollOver = function():Void{
      xMove = this._x;
   }

   this["button_" + i].onRollOut = function():Void{
      xMove = xMoveBack;
   }

}


Y si todos los botones van a hacer lo mismo, no repitas código, utiliza ciclos, si no vas a complicarte demasiado.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox

 

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