Código ActionScript :
var myXML:String miXML = new XML(); miXML.ignoreWhite = true; miXML.load(_level0.myXML); miXML.onLoad = function(status) { if (status) { datosxml = this.firstChild.childNodes; // Creamos MC _root.createEmptyMovieClip("mc", -16384); // Cargamos imagen en MC loadMovie(datosxml[0].attributes.imagen, "mc"); // Posicionamos MC mc._x = 0; mc._y = 0; // Cargamos texto _root.createTextField("textoproducto",1,0,25,85,20); _root.createTextField("textocliente",2,0,40,85,20); myformat = new TextFormat(); myformat.color = 0x888888; textoproducto.text = datosxml[0].attributes.nombre; textocliente.text = datosxml[0].attributes.cliente; textoproducto.setTextFormat(myformat); textocliente.setTextFormat(myformat); delete miXML; } else { textoproducto.text = "Información no cargada"; } }; boton_der.onRelease = function() { // Nächstes Bild if (producto < datosxml.length - 1) { producto++; loadMovie(datosxml[producto].attributes.imagen, "mc"); textoproducto.text = datosxml[producto].attributes.nombre; textoproducto.setTextFormat(myformat); boton_izq._visible=true; } if (producto > 0) { } }; boton_izq._visible=false; boton_izq.onRelease = function() { // Vorheriges Bild if (producto > 0) { producto--; loadMovie(datosxml[producto].attributes.imagen, "mc"); textoproducto.text = datosxml[producto].attributes.nombre; textoproducto.setTextFormat(myformat); } if (producto == 0) { boton_izq._visible=false; } };
Código XML :
<imagenes> <producto nombre="Producto1" cliente="Cliente1" imagen="img/producto1.jpg"></producto> <producto nombre="Producto2" cliente="Cliente2" imagen="img/producto2.jpg"></producto> <producto nombre="Producto3" cliente="Cliente3" imagen="img/producto3.jpg"></producto> </imagenes>