Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/09/2011, 12:48
javietxu
 
Fecha de Ingreso: septiembre-2011
Mensajes: 1
Antigüedad: 12 años, 7 meses
Puntos: 0
Cargar noticia xml

Esoy empezando con esto de Actionscript, y tengo un problema.
Tengo una plantilla para publicar noticias con una botonera "menú", que carga un xml que contiene los textos....

El caso es que no consigo que cuando se carga el clip de película, cargue directamente la primera noticia del xml, y tengo que pulsar en el primer boton para que aparezca.

ALmas solidarias, ayudarme, gracias.

Cita:
var news: Number = 0;
var separacion: Number = 5;
var ancho_Escenario: Number = 600;

_root.createEmptyMovieClip("foto", 10);
foto._x=342.4;
foto._y=182.0;

var agenda_noticias: XML = new XML();
agenda_noticias.ignoreWhite = true;


function parsea (exito: Boolean){
if (exito){
_root.createEmptyMovieClip("menu", 11);
menu._visible = true;

nombre.htmlText = "<p align=\"center\"><b>" + this.firstChild.nodeName.toUpperCase() + "</b>: Seleccione el número de noticia</p>";

for (var i = 0; i < this.firstChild.childNodes.length; i++){
for (var j = 0; j < this.firstChild.childNodes[i].childNodes.length; j++){

menu.attachMovie("nueva_noticia", "boton"+news, news);
menu["boton" + news].numero.text = news + 1;
menu["boton" + news]._x = news * (menu["boton"+news]._width + separacion);

menu["boton" + news].id = this.firstChild.childNodes[i].childNodes[j].attributes.id;
menu["boton" + news].cabecera = this.firstChild.childNodes[i].childNodes[j].attributes.cabecera;
menu["boton" + news].url = this.firstChild.childNodes[i].childNodes[j].attributes.url;
menu["boton" + news].fecha = this.firstChild.childNodes[i].attributes.dia;

menu["boton" + news].onRelease = function(){
fechacabeza.htmlText = "<p align=\"left\"><b>" + this.fecha + "</p>";
cabecera.htmlText = "<p align=\"left\"><b>" + this.cabecera + "</p>";
if (this.url != "no"){
foto.loadMovie(this.url);
} else {
foto.loadMovie("fotografias/no.jpg");
}


var cargador: LoadVars = new LoadVars();
cargador.onLoad = function(exito: Boolean){
if (exito){
cuerpo.text = cargador.texto;
} else {
cuerpo.text = "No se pudo cargar el texto de esta noticia";
}
delete cargador;
}
cargador.load("textos/" + this.id + ".txt")
}

news++;
}
}
menu._x = (ancho_Escenario / 2) - (menu._width / 2);
menu._y = 10;
menu._visible = true;
} else {
nombre.htmlText = "<p align=\"center\"><b>Error al cargar los datos</b></p>";
}
}

agenda_noticias.onLoad = parsea;
agenda_noticias.load("noticias.xml");