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

Problema con actionScript

Estas en el tema de Problema con actionScript en el foro de Flash y Actionscript en Foros del Web. Buenas, a ver si podeis ayudarme: Estoy un poco pez en esto del AS y necesito de buestra colaboración. Estoy haciendo una animación, cuyos datos(platos ...
  #1 (permalink)  
Antiguo 10/01/2006, 01:49
 
Fecha de Ingreso: mayo-2005
Mensajes: 39
Antigüedad: 18 años, 11 meses
Puntos: 0
Pregunta Problema con actionScript

Buenas, a ver si podeis ayudarme:

Estoy un poco pez en esto del AS y necesito de buestra colaboración. Estoy haciendo una animación, cuyos datos(platos de un restaurante) los pillo de un XML generado. El caso es que me los coje bien, o eso parece, pero luego al mostrarlos, no me muestra nada. Os dejo aqui el código. No se si es que va todo junto o una parte del código va en otra parte, eso no lo tengo muy claro.
El código lo saque de este foro, pero no encontre el mensaje donde venía:

Cita:
var playlistXML:XML = new XML();
playlistXML.ignoreWhite = true;
playlistXML.onLoad = function() {
var tempArray = new Array();
for (var i = 0; i<this.firstChild.childNodes.length; ++i) {
tempArray[i] = new Object();

tempArray[i].comentaris = this.firstChild.childNodes[i].attributes.id;

tempArray[i].data = this.firstChild.childNodes[i].attributes.plato;

tempArray[i].label = this.firstChild.childNodes[i].attributes.precio;

tempArray[i].imatge = this.firstChild.childNodes[i].attributes.tipo;

}

playlist_lb.dataProvider = tempArray;
};

playlistXML.load("resta.xml");

var playlist_lbListener:Object = new Object();
playlist_lbListener.change = function() {
currentSong = playlist_lb.selectedItem.data;
currentImatge = playlist_lb.selectedItem.imatge;
currentTitol = playlist_lb.selectedItem.label;
currentComentari = playlist_lb.selectedItem.comentaris;
comentari_txt.htmlText = "<b>"+currentTitol+"</b>"+"<br><i>"+currentComentari+"</i>";
loadMovie(currentImatge, "imatge_mc");
flagElectAudio = true;
};
Espero que me podais ayudar
Un saludo
Gracias
  #2 (permalink)  
Antiguo 10/01/2006, 11:32
Avatar de bernethe  
Fecha de Ingreso: abril-2004
Ubicación: San José, Costa Rica
Mensajes: 384
Antigüedad: 20 años
Puntos: 2
trata con estos cambios
Código:
var playlistXML:XML = new XML();
playlistXML.ignoreWhite = true;
playlistXML.load("resta.xml");
playlistXML.onLoad = function(ok) {
	if (ok) {
		trace(playlistXML)
		var tempArray = new Array();
		for (var i = 0; i<playlistXML.firstChild.childNodes.length; ++i) {
			tempArray[i] = new Object();
			tempArray[i].comentaris = playlistXML.firstChild.childNodes[i].attributes.id.toString();
			tempArray[i].data = playlistXML.firstChild.childNodes[i].attributes.plato.toString();
			tempArray[i].label = playlistXML.firstChild.childNodes[i].attributes.precio.toString();
			tempArray[i].imatge = playlistXML.firstChild.childNodes[i].attributes.tipo.toString();
		}
		playlist_lb.dataProvider = tempArray;
	}
};
var playlist_lbListener:Object = new Object();
playlist_lbListener.change = function() {
	currentSong = playlist_lb.selectedItem.data.toString();
	currentImatge = playlist_lb.selectedItem.imatge.toString();
	currentTitol = playlist_lb.selectedItem.label.toString();
	currentComentari = playlist_lb.selectedItem.comentaris.toString();
	comentari_txt.htmlText = "<b>"+currentTitol+"</b>"+"<br><i>"+currentComentari+"</i>";
	imatge_mc.loadMovie(currentImatge);
	flagElectAudio = true;
};
__________________
..::BERNETHE::..
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 10:23.