la clase
//Inicio declaración de la clase
class Objects.Destino{
/* PROPIEDADES */
private var str_nombre:String;
private var str_descripcion:String;
private var str_imagen:String;
private var str_mapa:String;
//Función constructora
function Destino () {
//Apuntador "this" indica que se refiere a los elementos de la clase
_global.Cls = this
}
public function XMLLoad() {
var strxml_nombre:String;
var strxml_descripcion:String;
var strxml_imagen:String;
var strxml_mapa:String;
//if (exito) {
var nodo:XML = new XML();
nodo = XML("Destinos.xml");
strxml_nombre = nodo.firstChild.childNodes[1].firstChild.nodeValue;
strxml_descripcion = nodo.firstChild.childNodes[0].firstChild.nodeValue;
strxml_imagen = nodo.firstChild.childNodes[2].firstChild.nodeValue;
strxml_mapa = nodo.firstChild.childNodes[3].firstChild.nodeValue;
//_global.esto.onCarga();
_global.Cls.UpdateProperties(strxml_nombre,strxml_descripcion,strxml_imagen,strxml_mapa);
/*} else {
trace("Error al cargar XML");
}*/
}
function UpdateProperties(dname:String, ddescrip:String,dimage:String,dmap:String) {
str_nombre=dname;
str_descripcion=ddescrip;
str_imagen=dimage;
str_mapa=dmap;
}
//Setters | Getters
public function get nombre():String {
return this.str_nombre;
}
public function get descripcion():String {
return this.str_descripcion;
}
public function get imagen():String {
return this.str_imagen;
}
public function get mapa():String {
return this.str_mapa;
}
}
el action dentro de flash
import Objects.Destino;
var root = this;
var ObjDestino:Destino = new Destino();
ObjDestino.XMLLoad();
root.TxtNombre.text = ObjDestino.nombre;
root.TxtDescrip.text = ObjDestino.descripcion;
stop();
y sale esto
Undefined
Undefined
en los 2 campos