Código :
stop();
var cargator_mcl:MovieClipLoader = new MovieClipLoader ();
var espia:Object = new Object ();
var total:Number = _root.getBytesTotal();
var parcial:Number = _root.getBytesLoaded();
cargator_mcl.addListener(espia);
espia.onLoadStart = function() {
_root.attachMovie('precarga', 'barra', 1000);
barra._x = 230;
barra._y = 90;
}
espia.onLoadProgress = function(clip, parcial, total) {
barra._xscale = parcial / total * 100;
}
espia.onLoadComplete = function() {
barra.unloadMovie();
}
BtnActual = false;
activateItem = function(item) {
// función que activa el botón.
// Verifica si hay otro boton activado anteriormente, si es así entonces lo desactiva
if (BtnActual != false) this.deActivateItem(); // aqui desactiva el boton anteriormente presionado
// Activa finalmente el boton presionado
BtnActual = item; // aqui guarda el ultimo botón presionado
BtnActual.gotoAndStop(BtnActual._totalframes); // se detiene en el ultimo frame de la animación
BtnActual.enabled = false; // deshabilita el boton, así no responde a los eventos del mouse
BtnActual.swActivo = true;
// trace("Activa (" + BtnActual._name + ")");
};
deActivateItem = function() {
// desactiva el ultimo boton activado
BtnActual.enabled = true; // vuelve a responder a los eventos del mouse
// se elimina el efecto tween, por ya estar implementado
BtnActual.atras = true; // prende el switch para iniciar animación alreves
BtnActual.swActivo = false;
BtnActual = undefined;
};
stop();
//*********************************************************************************************************
// aqui se definen las funciones de tus botones (que deben ser movieclips)
//*********************************************************************************************************
var myButtons = [this.b1, this.b2, this.b3, this.b4, this.b5]; // estos deben ser movieclips, NO botones
var mySWFs = ["1","images/" + "2","images/" + "1","",""]; // nombres de los SWF para cada boton
for (var i=0; i<myButtons.length; i++) {
myButtons[i].swActivo = false; // switch para detectar cuando esta activo el boton
myButtons[i].SWF = mySWFs[i] + ".swf";
myButtons[i].atras = false; // debes hacer referencia a una variable del botón.
myButtons[i].onRollOver = function() {
this.gotoAndPlay(2);
};
myButtons[i].onRollOut = myButtons[i].onReleaseOutside = function() {
if (!this.swActivo) this.atras = true; // prende switch para iniciar animación alreves
};
myButtons[i].onEnterFrame = function():Void {
// esta funcion se define para cada botón
if (this.atras) { // hacer referencia a una variable del boton
Foto = this._currentframe - 1;
this.gotoAndStop(Foto);
if (this._currentframe == 1) this.atras = false; // termina animación alreves
}
}
myButtons[i].onRelease = function() {
this._parent.activateItem(this);
cargator_mcl.loadClip(this.SWF, intercambio2);
}
}; // aqui se cierra la llave
b1.onRelease(); // se selecciona el primer boton 