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

Como hacer que este código carge una 2ª imagen

Estas en el tema de Como hacer que este código carge una 2ª imagen en el foro de Flash y Actionscript en Foros del Web. Buenas resulta que he sacado de internet un código que hace que presionando un botón la imagen siguiente y escriba un texto, con ayuda de ...
  #1 (permalink)  
Antiguo 16/06/2010, 10:39
 
Fecha de Ingreso: junio-2010
Mensajes: 10
Antigüedad: 13 años, 10 meses
Puntos: 0
Como hacer que este código carge una 2ª imagen

Buenas
resulta que he sacado de internet un código que hace que presionando un botón la imagen siguiente y escriba un texto, con ayuda de un XML, que es donde están el nombre de las imágenes así como sus dirección, texto que se escribe en el área y orden. pero lo que yo quisiera en vez de que cargase 1 imagen, es que en otra área cargara otra a la vez, lógicamente en el utilizando el XML.

Cita:
var loader:URLLoader = new URLLoader();
var XmlExterno:XML;
var i:Number=0;
var lista:XMLList;
var total:Number;
var fotos = new Loader();
addChild(fotos);
fotos.x = 519,6;
fotos.y = 210,1;
//var idioma = new Loader();
//addChild(idioma);
//idioma.x = 516,8;
//idioma.y = 448,4;

loader.addEventListener(Event.COMPLETE,cargarXML);
loader.load(new URLRequest("galeria.xml"));



function cargarXML(event:Event){
var cargador:URLLoader = event.target as URLLoader;
XmlExterno = new XML(cargador.data);

lista=XmlExterno.children();
total=lista.length();
var foto = new Loader();
addChild(foto);

//lista=XmlExterno.children();
//total=lista.length();
//var idioma = new Loader();
//addChild(idioma)

descripcion.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
//idioma.load(new URLRequest(lista[i].attribute("idioma")));


}
//boton1
boton1.addEventListener(MouseEvent.CLICK,siguiente );
boton2.addEventListener(MouseEvent.CLICK,atras);
//boton2

function siguiente(event:MouseEvent){
if(i<total-1)i++;
descripcion.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
//idioma.load(new URLRequest(lista[i].attribute("idioma")));
}


function atras(event:MouseEvent){
if(i>0)i--;
descripcion.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
//idioma.load(new URLRequest(lista[i].attribute("idioma")));
}
lo que se encuentra anulado es lo que he añadido yo pero lógicamente no funciona.
aquí el XML

Cita:
<galeria titulo="titulo galeria">
<foto id="1" imagen="imagenes/001.jpg" descripcion="1111111"/>
<foto id="2" imagen="imagenes/002.jpg" descripcion="texto 2" idioma="idioma/m6.png"/>
</galeria>
la etiqueta "idioma" se la añadí yo para intentar que carge otra imagen
alguien me hecha una mano gracias.

Etiquetas: Ninguno
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:56.