aiudaa
Código as3:
Ver original
package secciones.News { import fl.containers.*; import flash.events.*; import flash.display.MovieClip; import flash.net.*; import flash.display.Loader; import flash.display.MovieClip; import flash.events.Event; import flash.net.URLLoader; import flash.net.URLRequest; public class Main2 extends MovieClip { private var url:String="http://stage.sedal-mag.com/wsNewsSedal.php"; //private var url:String="http://stage.sedal-mag.com/wsNewsSedal.php?cat=18"; private var xml:XML; public function Main2() { var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, function(event:Event){ var loader:URLLoader = event.target as URLLoader; xml=new XML(loader.data); //trace(xml); for(var i:int;i<xml.item.length();i++){ //trace(xml.item[i].title); var NewsMiniatura:mcElementoListaNotas = new mcElementoListaNotas; NewsMiniatura.x=0; NewsMiniatura.y=100*i; NewsMiniatura.name="New_"+i; //carga los datos xml del NewsMiniatura.cargador.visible=false; NewsMiniatura.lbltitulo.text=xml.item[i].title; NewsMiniatura.loadImagen.source=xml.item[i].imagelink; NewsMiniatura.addEventListener(MouseEvent.CLICK, function(event:MouseEvent){ var newMiniatura:mcElementoListaNotas = event.currentTarget as mcElementoListaNotas; var name:String=newMiniatura.name; var id:int= name.split("_")[1]; InstanceName_0.cargador.visible=false; InstanceName_0.lbltitulo.text=xml.item[id].title InstanceName_0.detalle.htmlText="<font color='#FFFFFF'>"+xml.item[id].content+"</font>" if(xml.item[id].imagelink!=""){ var ldr:Loader=new Loader(); ldr.load(new URLRequest(xml.item[id].imagelink)) InstanceName_0.contenedorImagen.addChild(ldr) } }); NewsMiniatura.buttonMode= true; PanelNews.addChild(NewsMiniatura); } }); var request:URLRequest = new URLRequest(url); try { loader.load(request); } catch (error:Error) { trace("Error xml"); } } } }