Código :
//Declaro variables
real = 0;
separacion = 8;
//Creo el contenedor para cada espacio de la lista, y creo un contenedor para las fotos (ambos movieClips)
_root.attachMovie("real_estate");
_root.real_estate._x = 38;
_root.real_estate._y = 42;
_root.real_estate.createEmptyMovieClip("realtor_individual");
_root.real_estate.realtor_individual.persona.createEmptyMovieClip("cara", 10);
_root.real_estate.realtor_individual.persona.cara._x = 0;
_root.real_estate.realtor_individual.persona.cara._y = 0;
//Creo el documento XML y establezco su atributo "ignoreWhite" como true para los espacios en blanco
realtors_list = new XML();
realtors_list.ignoreWhite = 1;
//Esta es la funcion que deberia hacer que todo fluyera... pero no es asi :(
parsea = function (fluye) {
if (fluye) {
//Aqui deberia importar una instacia de clip por cada nodo de realtor
for (i=0; i<this.firstChild.childNodes.length; i++) {
for (j=0; j<this.firstChild.childNodes[i].childNodes.length; j++) {
_root.real_estate.realtor_individual.attachMovie("nuevo_realtor", "nuevo_realtor"+real, real);
_root.real_estate.realtor_individual["nuevo_realtor"+real].id.text = real+1;
// esto en teoria pondria todas las intancias importadas una sobre la otra
_root.real_estate.realtor_individual["nuevo_realtor"+real]._y = real*(_root.real_estate.realtor_individual["nuevo_realtor"+news]._height+separacion);
//Esto seria para asignar a cada instancia del clip los datos del archivo XML
_root.real_estate.realtor_individual["nuevo_realtor"+real].id = this.firstChild.childNodes[i].childNodes[j].attributes.id;
_root.real_estate.realtor_individual["nuevo_realtor"+real].nombre = this.firstChild.childNodes[i].childNodes[j].attributes.nombre;
_root.real_estate.realtor_individual["nuevo_realtor"+real].cell = this.firstChild.childNodes[i].childNodes[j].attributes.cell;
_root.real_estate.realtor_individual["nuevo_realtor"+real].email = this.firstChild.childNodes[i].childNodes[j].attributes.email;
_root.real_estate.realtor_individual["nuevo_realtor"+real].foto = this.firstChild.childNodes[i].childNodes[j].attributes.foto;
_root.real_estate.realtor_individual["nuevo_realtor"+real] = function () {
_root.real_estate.realtor_individual.nuevo_realtor.nombre.htmlText += "<p align=\"left\"> "+this.nombre+"</p>";
_root.real_estate.realtor_individual.nuevo_realtor.cell.htmlText += "<p align=\"left\"> "+this.email+"</p>";
_root.real_estate.realtor_individual.nuevo_realtor.email.htmlText += "<p align=\"left\"> "+this.email+"</p>";
//Pongo la foto y si no tiene foto carga el archivo sinfoto.jpg
if (this._root.real_estate.realtor_individual.nuevo_realtor.cara="no") {
_root.real_estate.realtor_individual.nuevo_realtor.foto.loadMovie(this.cara);
} else {
cara.loadMovie("fotos/sinfoto.jpg");
}
};
}
real++;
}
}
//Lo ubico dentro del MC creado anteriormente
real_estate.realtor_individual._x = 0;
real_estate.realtor_individual._y = 0;
};
//Lanzo la funcion y cargo el archivo XML
realtors_list.onLoad = parsea;
realtors_list.load("realtors/realtors.xml");
