Foros del Web » Creando para Internet » Flash y Actionscript »

funcion y XML

Estas en el tema de funcion y XML en el foro de Flash y Actionscript en Foros del Web. Código: //TENGO UN XML QUE SE LLAMA LIBROS //UN CLIP QUE SE LLAMA mcLibro //INTENTO QUE AL HACER ROLLOVER SOBRE CADA LIBRO ME DEVUELVA LA ...
  #1 (permalink)  
Antiguo 18/12/2006, 12:51
 
Fecha de Ingreso: septiembre-2006
Mensajes: 9
Antigüedad: 17 años, 7 meses
Puntos: 0
funcion y XML

Código:
//TENGO UN XML QUE SE LLAMA LIBROS
//UN CLIP QUE SE LLAMA mcLibro
//INTENTO QUE AL HACER ROLLOVER SOBRE CADA LIBRO ME DEVUELVA LA PROPIEDAD AUTOR 
// Y LA ESCRIBA EN UN CAMPO DE TEXTO
//EL CASO ES QUE NO SE ESCRIBE NADA EN EL CAMPO DE TEXTO, PERO SI HAGO UN TRACE 
// SI QUE FUNCIONA
// LA PELICULA TIENE 2 FRAMES Y ESTE CODIGO APARECE EN EL 1ER. FRAME
var largo:Number;
var oXML:XML = new XML();
oXML.ignoreWhite = true;
oXML.onLoad = function(success):Void  {
	if (success) {
		largo = oXML.firstChild.childNodes[0].childNodes.length;
		crearLibros(largo);
	} else {
		trace("error");
	}
};
oXML.load("LIBROS.xml");
function crearLibros(numero:Number):Void {
	for (var i:Number = 0; i < numero; i++) {
		this.mcLibro.duplicateMovieClip("mcLibro" + i, this.getNextHighestDepth());
		this["mcLibro" + i]._x = this["mcLibro" + (i - 1)]._x + this["mcLibro" + i]._width;
		this["mcLibro" + i].autor = oXML.firstChild.childNodes[0].childNodes[i].attributes.autor;
		this["mcLibro" + i].onRollOver = function():Void  {
			//ME DEVUELVE LA PROPIEDAD AUTOR
			trace(this.autor);
			//PERO EL TEXTO NO MUESTRA NADA
			_root.tDatos.text = this.autor;
		};
	}
}
  #2 (permalink)  
Antiguo 18/12/2006, 14:56
 
Fecha de Ingreso: septiembre-2006
Mensajes: 1.193
Antigüedad: 17 años, 6 meses
Puntos: 30
Re: funcion y XML

Código:
_root.tDatos.text = this.autor;
1.- checa bien la ruta segurate que este en la escena principal el campo de texto
2.- checa que el nombre de instancia sea el mismo
3.-(parece tonta pero pasa) checa que el color de fondo y en de la letra no sea el mismo.
4.-si aun no puedes borra el nombre de instancia de tu texto tDatos y en la ventana de propiedades en el campo de variable a tu texto dinamico le pones el nombre que habias puesto de instancia osea tDatos vas a tu codigo y le quitas el .text osea asi quedaria


_root.tDatos = this.autor;
  #3 (permalink)  
Antiguo 18/12/2006, 15:21
 
Fecha de Ingreso: septiembre-2006
Mensajes: 9
Antigüedad: 17 años, 7 meses
Puntos: 0
Re: funcion y XML

ok Rizzo, muchas gracias, ya encontre el fallo: el txt aparecia en los fotogramas pero en el segundo estaba sin nombrar.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:24.