Comunidad de diseño web y desarrollo en internet online

Acrtion script y *.as

Citar            
MensajeEscrito el 22 Sep 2004 04:01 pm
tengo problemas no se cual sera


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

Por easycsc

6 de clabLevel



 

unknown
Citar            
MensajeEscrito el 22 Sep 2004 07:32 pm
quita eso _global.Cls

un apuntador pa q ??
ni siquiera nesecitas de this

llama directamente :

Código :

UpdateProperties(strxml_nombre,strxml_descripcion,strxml_imagen,strxml_mapa);


no hace falta usar this para referirse a la instancia

salu2

Por buho29

510 de clabLevel

1 tutorial

7 ejemplos

 

unknown
Citar            
MensajeEscrito el 22 Sep 2004 08:54 pm
veo varias cosas raras en esa clase:

1. parece q extendiera a XML pero no lo hace

2. var nodo:XML = new XML();
nodo = XML("Destinos.xml"); //<-- ????

3. getters? setters? mucha vuelta para eso! se podria resumir toda esa clase con un

Código :

objXML=new XML();
objXML.onLoad=function(exito)
{
if(exito)
//asignar valores aqui
}

Por _david

565 de clabLevel


1 articulo

Genero:Masculino  

Bogota, Colombia

unknown

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.