Hi guys!!
please look at my class…
why my getLista() method,
does not work ???
i will post my entire package [URL=“http://www.tiagofernandez.com/class.zip”]HERE
please help me to make my method work.
import mx.utils.Delegate;
import com.tiago.Site.ListaDeObjetos;
import com.tiago.Site.Trabalhos;
import com.tiago.Site.Portifolio;
/**
- @Sun Jan 21 18:24:45 2007
- @author
-
@version
**/
class com.tiago.XMLUtils.XMLParser {
private var Xpath : String ;
private var itensObj : Trabalhos = null ;
private var lista:Array;
private var tempLista:Array;
//private var lista : ListaDeObjetos = null;
private var meuXML : XML ;
function XMLParser (Xpath : String) {
this.Xpath = Xpath;
this.lista = new Array();
this.tempLista = new Array();
//this.lista = new ListaDeObjetos();
init();
}
public function getXpath () : String {
return Xpath;
}
public function setXpath (Xpath : String) : Void {
this.Xpath = Xpath;
}
public function setLista(Obj:Object):Void {
this.lista.push(Obj);
}
public function getLista():Array {
return lista;
}
public function init () : Void {
var oThis = this;
meuXML = new XML();
meuXML.ignoreWhite = true;
meuXML.onLoad = Delegate.create (this, onXmlLoaded);
meuXML.load (Xpath);
}
public function parse():Void{
for (var i = 0; i < meuXML.childNodes [0].childNodes.length; i ++) {
var _id:String = (meuXML.firstChild.childNodes .attributes.id);
var _titulo:String = (meuXML.firstChild.childNodes .attributes.titulo);
var _imagem:String = (meuXML.firstChild.childNodes.attributes.image);
var _descricao:String = (meuXML.childNodes[0].childNodes.childNodes[0].childNodes);
itensObj = new Trabalhos (_id, _titulo, _descricao, _imagem);
//lista.push(itensObj);
[COLOR=red][COLOR=black]setLista(itensObj);[/COLOR] — this work fine.[/COLOR]
[COLOR=red][/COLOR]
[COLOR=red]//getLista(); [/COLOR]***[COLOR=red] i can use this method outside this scope!!! heeeelp!!! i want to use this class method outsite the class in my flash movie… :puzzled::([/COLOR]
}
}
public function onXmlLoaded (success : Boolean) : Void {
if (success){parse();} else { trace (“ERRO AO TRADUZIR O XML”); }
}
}