Ver Mensaje Individual
  #4 (permalink)  
Antiguo 14/02/2005, 11:53
Avatar de bms
bms
 
Fecha de Ingreso: febrero-2005
Mensajes: 15
Antigüedad: 19 años, 2 meses
Puntos: 0
que tal chicos.

Nota: puede que este ejemplo no funcione correctamente, no lo he probado, solo escribo codigo en el editor de texto del foro.

aver, supongamos que tenemos x foto y queremos hacer un paneo de esta en la escena, dependiendo en que boton se pose el cursor del usuario.

Entonces, metemos la foto a un mc que llamaremos "foto". la ponemos en la escena, y en un layer mas arriba, ponemos los botones con sus respectivas flechas direccionales, uno llamado "boton_derecha" y el otro "boton_izquierda".

Código:
boton_derecha.onRollOver=function(){
   foto.onEnterFrame=function(){
       this._x+=5;
   }
}
boton_izquierda.onRollOver=function(){
   foto.onEnterFrame=function(){
       this._x-=5;
   }
}
boton_izquierda.onRollOut=boton_derecha.onRollOut=function(){
   foto.onEnterFrame = null;
}
ahora bien, lo que hicimos, es que sume o reste valores en la propiedad _x del mc "foto" dependiendo del boton en que el usuario se pose. y si no se posa en ninguno, pues que se detenga.

Ahora necesitamos que este mc se detenga en sus topes.. entonces agregaremos un bloque desicivo.

Nota: el siguiente codigo, si tuve que probarlo ^^

Código:
ancho_tope = Stage.width; //el ancho de mi escena.
boton_derecha.onRollOver = function() {
	foto.onEnterFrame = function() {
		if (foto._x<0) {
			this._x += 5;
		}
	};
};
boton_izquierda.onRollOver = function() {
	foto.onEnterFrame = function() {
		if ((foto._x+foto._width)>ancho_tope) {
			this._x -= 5;
		}
	};
};
boton_derecha.onRollOut = boton_izquierda.onRollOut=function () {
	foto.onEnterFrame = null;
};
les dejo el fla con que arme este code para que se entienda mejor aqui.
http://descargas.bracciniart.com.ar/handy_img_pan.fla

saludos!