Para el XML
Abrimos el bloc de notas o dreamweaver y generamos el xml
PARA EL FLA
1. creamos el archivo fla.
2. creamos un boton de siguiente y uno de anterior, los instanciamos
3. creamos un texto dinámico instanciado cmo "textico"
4. en la capa acciones colocamos el siguiente código
var carga:URLLoader = new URLLoader();
var xmlExterno:XML;
var i:Number=0;
var lista:XMLList;
var total:Number;
var fotos = new Loader();
addChild(fotos);
fotos.x = 100;
fotos.y=50;
var xmlExterno:XML;
var i:Number=0;
var lista:XMLList;
var total:Number;
var fotos = new Loader();
addChild(fotos);
fotos.x = 100;
fotos.y=50;
carga.load(new URLRequest("galeria.xml"));
carga.addEventListener(Event.COMPLETE,cargarXML);
carga.addEventListener(Event.COMPLETE,cargarXML);
function cargarXML(evento:Event)
{
xmlExterno = new XML(evento.target.data)
lista=xmlExterno.children();
total=lista.length();
descripcion_txt.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
}
{
xmlExterno = new XML(evento.target.data)
lista=xmlExterno.children();
total=lista.length();
descripcion_txt.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
}
siguiente_btn.addEventListener(MouseEvent.CLICK, siguiente);
anterior_btn.addEventListener(MouseEvent.CLICK, atras);
anterior_btn.addEventListener(MouseEvent.CLICK, atras);
function siguiente(event:MouseEvent)
{
if (i
{
i++;
descripcion_txt.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
}
}
{
if (i
{
i++;
descripcion_txt.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
}
}
function atras(event:MouseEvent)
{
if (i>0)
{
i--;
descripcion_txt.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
}
}
{
if (i>0)
{
i--;
descripcion_txt.text=lista[i].attribute("descripcion");
fotos.load(new URLRequest(lista[i].attribute("imagen")));
}
}
No hay comentarios:
Publicar un comentario