Comunidad de diseño web y desarrollo en internet online

desplazamiento de movieclip

Citar            
MensajeEscrito el 16 Sep 2009 03:43 pm
Hola, tengo un problema con flash, queria ver si alguien me puede ayudar porque me estoy volviendo loca...
tengo un movieclip llamado mc1, es una barra horizontal, donde van pasando varias imagenes, 2 botones bt3 y bt4. Con estos botones muevo la barra sobre el eje x de un lado a otro;
en realdiad lo que yo deseo es que la barra se mueva de un lado a otro por defecto mostrando todas las imagenes que tiene, pero que cuando me paro sobre los botones pare y vaya hacia el lado que indique el boton (derecha o izquierda). les paso el codigo que tengo escrito, en realidad lo que me falta es esto de que se mueva por defecto porque lo de los botones ya esta.
no se si me explique bien?
desde ya muchas gracias a quien me ayude!
este es el codigo:

Código ActionScript :

bt3.onRollOver = function() {
   Fin = -418.8;
   limite = Fin+10;
   this.onEnterFrame = function() {
      if (_root.mc1._x>=limite) {
         _root.mc1._x -= 10;
      } else {
         _root.mc1._x = Fin;
         delete this.onEnterFrame;
      }
   };
};
bt3.onRollOut = function() {
   delete this.onEnterFrame;
};
bt4.onRollOver = function() {
   Inicio = 414.1;
   limite = Inicio-10;
   this.onEnterFrame = function() {
      if (_root.mc1._x<=limite) {
         _root.mc1._x += 10;
      } else {
         _root.mc1._x = Inicio;
         delete this.onEnterFrame;
      }
   };
};
bt4.onRollOut = function() {
   delete this.onEnterFrame;
};

Por taccoli

12 de clabLevel



 

firefox
Citar            
MensajeEscrito el 16 Sep 2009 04:09 pm
Hola,
puedes usar una variable auxiliar "var speed:Number = 10" que guardará la velocidad a la que se moverá la tira de imágenes, y poner el evento enterFrame fuera de los eventos onRollOver. En el enterFrame mueves la tira en la cantidad "speed", en el rollOver haces speed = 0, y en los rollOut vuelves a poner speed = 10 (ó speed = -10 en el otro botón).

Por isidoro

Claber

498 de clabLevel

2 tutoriales

Genero:Masculino  

firefox
Citar            
MensajeEscrito el 16 Sep 2009 06:23 pm
justo me respondieron en otro foro; de todos modos gracias a tu respuesta tambien lo entendi mucho mas!!!! muchas gracais

dejo el codigo por las dudas

var Fin:Number = -418.8;
var limite2:Number = Fin+10;
var Inicio:Number = 414.1;
var limite1:Number = Inicio-10;
var MC:MovieClip = this.createEmptyMovieClip("MC", this.getNextHighestDepth());
MC.onEnterFrame = function() {
if (_root.mc1._x>=limite2) {
_root.mc1._x -= 10;
} else {
_root.mc1._x = Fin;
}
};
bt3.onRollOver = function() {
delete this._parent.MC.onEnterFrame
this.onEnterFrame = function() {
if (_root.mc1._x>=limite2) {
_root.mc1._x -= 10;
} else {
_root.mc1._x = Fin;
delete this.onEnterFrame;
}
};
};
bt3.onRollOut = function() {
delete this.onEnterFrame;
};
bt4.onRollOver = function() {
delete _root.MC.onEnterFrame
this.onEnterFrame = function() {
if (_root.mc1._x<=limite1) {
_root.mc1._x += 10;
} else {
_root.mc1._x = Inicio;
delete this.onEnterFrame;
}
};
};
bt4.onRollOut = function() {
delete this.onEnterFrame;
};

Por taccoli

12 de clabLevel



 

firefox

 

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