Tema: swap depths
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2004, 12:29
Avatar de rgr ptr
rgr ptr
 
Fecha de Ingreso: noviembre-2002
Ubicación: bcn
Mensajes: 188
Antigüedad: 21 años, 5 meses
Puntos: 0
swap depths

Hola a todos

Tengo un código que hace tiempo me cedió alguien sobre cómo intercambiar dinámicamente las profundidades de movieclips. Os lo transcribo con las adaptaciones.

En un frame hay lo siguiente:
Código:
Array.prototype.getIndex = function(value) {
	for (var j = 0; j<this.length; j++) {
		if (this[j] == value) {
			return j;
		}
	}
	return false;
};
Array.prototype.shuffleDown = function(index) {
	var current = this[index];
	var before = this.slice(0, index);
	var after = this.slice(index+1, this.length);
	var tmp = before.concat(after, current);
	return tmp;
};
MovieClip.prototype.relay = function() {
	for (var k = 0; k<total; k++) {
		_root[height[k]].swapDepths(k);
	}
};
height = ["foto_1", "foto_2"];
total = 2;
y en el botón lo siguiente:
Código:
_root.index = _root.height.getIndex(_name);
_root.height = _root.height.shuffleDown(_root.index);
_root.relay();
Lo que pasa es que aparte que se intercambien las profundidades de estos dos movieclips ( foto_1 y foto_2 ) me gustaría que hubieran dos más que siempre estuvieran por encima. El script que tengo, si le añado en las variables height y total más elementos no me sirve.

¿Me seguís?

help, plis