tengo el siguiente codigo con el q keria crear mis botones, mi motivacion era generarlos facilmente pero como siempre unos se encuentra con problemas
comenzemos por describir los objetos en la escena solo son 2 MC:
el primero un boton con un diseno cualquiera y con nombre de instancia boton_fotos.
y el segundo un MC con nombre de instancia "fotos_prod" que contendra las "fotos" una por cada frame y cuyo contenido cambia de acuerdo a lo presionado por la serie de botones q pongo en escena.
bueno mi codigo estaba de lo mejor para la puesta de MCs pero cuando quiero definer sus propiedades de botones surge mi problema, despues de darle mucha vueltas no logro hacer automaticamente lo q termine haciendo en forma manual como veran en el codigo
Al menos me gustaria q los botones reaccionen al "CLICK" y cambien el contenido de mi contenedor de fotos... espero alguien sepa como automatizar esta parte del codigo, le estaba dando vueltas con los listeners pero por ahora me rindo; el codigo esta acontinuacion y notaran con facilidad la parte solo pude avanzar rapidamente gracias al CTRL + C y CTRL + V
Código :
boton_fotos._visible = false;
stop();
//primeras variables
var pos_x:Number = boton_fotos._x;
var pos_y:Number = boton_fotos._y;
var btn_nums:Array = new Array("1","2","3","4");
var total:Number = btn_nums.length;
//creo los botones
for(i = 0 ; i<total; i++)
{
this.attachMovie("boton_fotos","btn_f"+i, this.getNextHighestDepth());
setProperty("btn_f"+i,_y,pos_y);
setProperty("btn_f"+i,_x,(pos_x + (i*35)));
this["btn_f"+i].bf_label.bf_num.text=btn_nums[i];
}
//ESTA ES LA PARTE Q NO ME GUSTA U_U
btn_f0.onRollOver = function() {
this.gotoAndPlay("in");
}
btn_f0.onRollOut = function() {
this.gotoAndPlay("out");
}
btn_f0.onRelease = function() {
_root.fotos_prod.gotoAndStop(1);
}
btn_f1.onRollOver = function() {
this.gotoAndPlay("in");
}
btn_f1.onRollOut = function() {
this.gotoAndPlay("out");
}
btn_f1.onRelease = function() {
_root.fotos_prod.gotoAndStop(2);
}
btn_f2.onRollOver = function() {
this.gotoAndPlay("in");
}
btn_f2.onRollOut = function() {
this.gotoAndPlay("out");
}
btn_f2.onRelease = function() {
_root.fotos_prod.gotoAndStop(3);
}
btn_f3.onRollOver = function() {
this.gotoAndPlay("in");
}
btn_f3.onRollOut = function() {
this.gotoAndPlay("out");
}
btn_f3.onRelease = function() {
_root.fotos_prod.gotoAndStop(4);
}
