Comunidad de diseño web y desarrollo en internet online

Asignar valor a variable global desde una funcion

Citar            
MensajeEscrito el 08 Oct 2008 07:25 pm
como puedo acceder a una variable global y alterar su contenido desde una funcion

por ejemplo:

_global.tamano=0;
imgXML=new XML();
imgXML.ignoreWhite=true;
imgXML.onLoad=function(succes){
if(succes){
for(var i=0;i<this.firstChild.childNodes.length;i++){
imagen=this.firstChild.childNodes[i].attributes.id;
}
_global.tamano=this.firstChild.childNodes.length;//altero el valor de la variable tamano
}
}
imgXML.load("imagenes.xml");
trace(_global.tamano);// <-pero sigue enviando 0

saludos...

Por amducias

4 de clabLevel



 

firefox
Citar            
MensajeEscrito el 09 Oct 2008 12:03 am

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox

 

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