Foros del Web » Creando para Internet » Flash y Actionscript »

Alguna de forma de reducir este codigo

Estas en el tema de Alguna de forma de reducir este codigo en el foro de Flash y Actionscript en Foros del Web. Hola a todos, bueno mi preg es que como podria reducir este codigo: excel_mc.onRollOver = function() { this._xscale = 125; this._yscale = 125; }; excel_mc.onRollOut ...
  #1 (permalink)  
Antiguo 24/07/2008, 13:00
 
Fecha de Ingreso: marzo-2008
Mensajes: 24
Antigüedad: 16 años, 1 mes
Puntos: 0
De acuerdo Alguna de forma de reducir este codigo

Hola a todos, bueno mi preg es que como podria reducir este codigo:

excel_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
excel_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
excel_mc.onPress = function() {
this.startDrag();
};
excel_mc.onRelease = function() {
this.stopDrag();
};

word_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
word_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
word_mc.onPress = function() {
this.startDrag();
};
word_mc.onRelease = function() {
this.stopDrag();
};

per_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
per_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
per_mc.onPress = function() {
this.startDrag();
};
per_mc.onRelease = function() {
this.stopDrag();
};

corel_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
corel_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
corel_mc.onPress = function() {
this.startDrag();
};
corel_mc.onRelease = function() {
this.stopDrag();
};

photo_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
photo_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
photo_mc.onPress = function() {
this.startDrag();
};
photo_mc.onRelease = function() {
this.stopDrag();
};
winzip_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
winzip_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
winzip_mc.onPress = function() {
this.startDrag();
};
winzip_mc.onRelease = function() {
this.stopDrag();
};
winrar_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
winrar_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
winrar_mc.onPress = function() {
this.startDrag();
};
winrar_mc.onRelease = function() {
this.stopDrag();
};
win_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
win_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
win_mc.onPress = function() {
this.startDrag();
};
win_mc.onRelease = function() {
this.stopDrag();
};
nod_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
nod_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
nod_mc.onPress = function() {
this.startDrag();
};
nod_mc.onRelease = function() {
this.stopDrag();
};
power_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
power_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
power_mc.onPress = function() {
this.startDrag();
};
power_mc.onRelease = function() {
this.stopDrag();
};
panda_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
panda_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
panda_mc.onPress = function() {
this.startDrag();
};
panda_mc.onRelease = function() {
this.stopDrag();
};
acrobat_mc.onRollOver = function() {
this._xscale = 125;
this._yscale = 125;
};
acrobat_mc.onRollOut = function() {
this._xscale = 100;
this._yscale = 100;
};
acrobat_mc.onPress = function() {
this.startDrag();
};
acrobat_mc.onRelease = function() {
this.stopDrag();
};


como veran es la misma accion para varios movie clips........................

si hay alguna manera de hacer mas pequeña.......
  #2 (permalink)  
Antiguo 24/07/2008, 13:17
Avatar de TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
Respuesta: Alguna de forma de reducir este codigo

Código:
buttons = [excel_mc, word_mc, per_mc];
for (a = 0; a < buttons.length; a++)
{
	buttons[a].onRollOver = function() {
		this._xscale = 125;
		this._yscale = 125;
	};
	buttons[a].onRollOut = function() {
		this._xscale = 100;
		this._yscale = 100;
	};
	buttons[a].onPress = function() {
		this.startDrag();
	};
	buttons[a].onRelease = function() {
		this.stopDrag();
	};
}
  #3 (permalink)  
Antiguo 25/07/2008, 15:43
Avatar de K-Yezaad  
Fecha de Ingreso: octubre-2005
Mensajes: 140
Antigüedad: 18 años, 6 meses
Puntos: 3
Respuesta: Alguna de forma de reducir este codigo

Y le podemos recortar un poco mas :P
Código:
buttons = [excel_mc, word_mc, per_mc];
for (a = 0; a < buttons.length; a++)
{
	buttons[a].onRollOver = function() {
		this._xscale = this._yscale = 125;
	};
	buttons[a].onRollOut = function() {
		this._xscale = this._yscale = 100;
	};
	buttons[a].onPress = function() {
		this.startDrag();
	};
	buttons[a].onRelease = function() {
		this.stopDrag();
	};
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:29.