Buttons dinámicos con Actionscript
Hola!!!
Tengo un problemilla. Con un for he ido creando botones con un Button que tenía en la biblioteca. Le he id o d ando un nombre diferente a cada uno. Ahora lo q ue quiero es que al seleccionarlo pueda visualizar una fot o. La cosa es que cuando lo presiono no me hace nada. Que puede ser?? Pongo el código y así sabeis si hay errores.
<code>function rellenar(){
var i:Number;
var total:Number;
var y:Number;
var x:Number;
var conta:Number;
x=0;
conta=0;
var titulo_txt:TextField;
var fecha_txt:TextField;
var btn_dat:MovieClip;
y=5;
total=dataNoticias.arrayNoticias.length;
for(i=total; i > 0 ; i--){
if (conta==4){
}
else{
conta++;
y=y+50;
btn_not=attachMovie("Button","btn_not"+i,x++);
btn_not._x=40;
btn_not._y=y;
btn_not.name="btn"+i;
btn_not.setSize(260, 20);
btn_not._alpha=15;
btn_not.setStyle("themeColor", "0xD5D5D5");
btn_not.useHandCursor=true;
btn_not.label=dataNoticias["noticia"+i].titulo;
btn_not.labelPlacement = "left";
btn_not.selectable=true;
_root.contenido02.createTextField("fecha_txt"+i,x++,50,y+15,260,18);
fecha_txt=_root.contenido02["fecha_txt"+i];
crear(fecha_txt,dataNoticias["noticia"+i].fecha);
name_txt.text=btn_not.name;
}
}
}
function crear(txt:TextField,dato:String){
var txtf:TextFormat = new TextFormat;
txt.text=dato;
txt.background=true;
txt.backgroundColor=0xD5D5D5;
txtf.color=0x016975;
txtf.font="Gill Sans MT";
txtf.size=12;
txt.multiline=false;
txt.selectable=false;
txt.setTextFormat(txtf);
}
al_pulsar = new Object();
al_pulsar.click = function(){
if (btn1.selected == true){
name_txt.text=" ";
}
else if(btn1.selected == false){
name_txt.text=" ";
}
}
btn1.addEventListener("click", al_pulsar);</code>
Le he puesto al_pulsar al btn1 para ver si funciona con este pero ni con esas. Si alguien me puede ayudar?? Gracias y un saludo!!!!!!!