[osflash] How To get ClassName dinamically?
Carlos Rovira
carlos.rovira at lycos.es
Thu Jun 2 09:19:11 PDT 2005
Hi,
@Keith:
If I write:
Flashout.info(eval("com.carlosrovira.SomeClass1"));
flashout says "undefined".
I think eval isn't the solution.
@David:
Hi David,
Thanks for your response, but I think that your code is too complicated...I'm sure that there's some trick or artifact to do this more easy.
----------------------------- Carlos Rovira -- www.carlosrovira.com ------------------------------
> De:: David Rorex <drorex at gmail.com>
> Para: Open Source Flash Mailing List <osflash at osflash.org>
> Asunto:: Re: RE: [osflash] How To get ClassName dinamically?
> BCC: Thu, 2 Jun 2005 08:57:49 -0700
> > Behalf Of Carlos Rovira
> > Sent: Thursday, June 02, 2005 11:14 AM
> > Subject: [osflash] How To get ClassName dinamically?
> >
> > Hi,
> >
> > I'm trying to getting a static var for a class that I get dinamically (the
> > name of the class is a concatenation of two strings).
> >
> > if class is : "com.carlosrovira.Somclass1" with static var "SymbolName"
> > (wich is a String)
> > and I have other class "com.carlosrovira.Somclass2" with the same
> > "SymbolName" static var,
> >
> > I want to compose the class name to get "com.carlosrovira.Somclass1" or
> > "com.carlosrovira.Somclass2" and call the static String var (i.e,
> > com.carlosrovira.Somclass1.SymbolName or
> > com.carlosrovira.Somclass1.SymbolName)
>
> What about something like:
>
> trace(_global["com"]["carlosrovira"]["Somclass1"]["SymbolName"])
>
> i think you could do something like using .split(".") on the string
> and looping through it somehow:
>
> var ar = ("com.carlosrovira.Somclass1.SymbolName").split(".");
> var ptr = _global;
> for(i=0;i<ar.length;i++)
> ptr = ptr[ar[i]];
>
> trace ptr ; // should give the contents of symbolname, but i didn't test it
>
>
> -David R
>
> _______________________________________________
> osflash mailing list
> osflash at osflash.org
> <a href=http://osflash.org/mailman/listinfo/osflash_osflash.org>http://osflash.org/mailman/listinfo/osflash_osflash.org</a>
Lycos Mail lanza el nuevo Sistema de Seguridad Protek-on. Olvídate para siempre de los virus y el correo basura (spam) para siempre. http://mail.lycos.es
More information about the osflash
mailing list