Comunidad de diseño web y desarrollo en internet online

Variables

Citar            
MensajeEscrito el 01 Jul 2011 03:16 pm
Hola amigos:
tengo un problema, tengo un txt con variables que contiene por ejemplo esto:

Código ActionScript :

txt1="hola"&txt2="cuadro"&txt3="ciudad"


lo cargo a mi pelicula en una fotograma de esta forma:

Código ActionScript :

var num:int = 1;
var var_txt:String = "";
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, loading);
loader.load(new URLRequest("txt/textos.txt"));


y la función llamada es la siguiente:

Código ActionScript :

function loading(event:Event):void
{
   for (var i = 1; i <= 3; i++)
   {
      trace(this[loader.data.txt+i]);
   }
}


o sea quiero que me tire un trace por cada uno de los tres variables que hay en el campo de texto y no hay forma jejejejeje

Por keyexpress

5 de clabLevel



 

chrome
Citar            
MensajeEscrito el 01 Jul 2011 06:50 pm

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 01 Jul 2011 08:14 pm
sabes que copie y pegue no me funciona

Por keyexpress

5 de clabLevel



 

chrome
Citar            
MensajeEscrito el 01 Jul 2011 08:16 pm
¿Copiar y pegar? ¿No sería mejor entender?

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 02 Jul 2011 10:47 pm
no logro entender puse copiar y pegar como ejemplificando que lo puse tal cual, no entra en el bucle y cuanto tiro un trace de evt.target.data.cant me dice que es un variable UNDIFINID como si no existiese

Por keyexpress

5 de clabLevel



 

chrome
Citar            
MensajeEscrito el 05 Jul 2011 01:54 pm
Pon el código tal cual lo tienes con las modificaciones

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 06 Jul 2011 02:06 pm

Código ActionScript :

var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
myLoader.load(new URLRequest("txt/noticias.txt"));
myLoader.addEventListener(Event.COMPLETE, onDataLoad);
myLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError)
myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError)
 myLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus)    

function onDataLoad(evt:Event)
{
trace(evt.target.data["txt_titulo" + 1])
for (var i:uint=0; i<evt.target.data.cant; i++)
{
trace(evt.target.data["txt_titulo" + i])
//this["obj_nota" + i].lbl_titulo.htmlText = "<b>" + evt.target.data["txt_titulo" + i] + "</b>";
//this["Comments_txt" + i].text = evt.target.data["Comments" + i];
//var loader:Loader = new Loader();
//this["holder_mc" + i].addChild(loader);
//loader.load(new URLRequest(evt.target.data["Image"+i]));
}
}

function onIOError(evt:IOErrorEvent){trace("IOError: "+evt.text)}

function onHTTPStatus(evt:HTTPStatusEvent){trace("HTTPStatus: "+evt.status)}

function onSecurityError(evt:SecurityErrorEvent){trace("SecurityError: "+evt.te
xt)}

Por keyexpress

5 de clabLevel



 

chrome

 

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