Or just use mx.utils.ClassFinder.

var classname:String = "com.mosesSupposes.fuse.Fuse";
var FuseClass:Function = mx.utils.ClassFinder.findClass(classname);
fuse = new FuseClass();

2006/1/30, franto <[EMAIL PROTECTED]>:
> thank you all, i've already made it!
>
> var str:String = 'test1.test2.ClassC';
> var arr = str.split('.');
> var variable = _global;
>
> for (var i=0;i<arr.length;i++)
> {
>         variable = variable[arr[i]];
>         trace(variable);
> }
> new variable();
>
>
>
> On 1/30/06, Serge <[EMAIL PROTECTED]> wrote:
> >
> >  import pkg1.pkg2.pkg3.*
> > or
> > import pkg1.*
> >
> >  >> new pkg1.pkg2.pkg3.className(),
> > sorry, should be:
> > new className()
> >
> >  make sure pkg1 has classes you would like to be compiled in swf or use
> >  exclude xml file
> >
> >
> >
> > On 1/30/06, franto <[EMAIL PROTECTED]> wrote:
> > >> Hi all,
> > >>
> > >> maybe it is easy, maybe not, but i cant figure it out now, and i need it
> > >> :)
> > >>
> > >> when i got class e,g    pkg1.pkg2.pkg3.className
> > >>
> > >> i can make new instance in this way
> > >> new pkg1.pkg2.pkg3.className()
> > >>
> > >> but i want to make it from string
> > >>
> > >> this dont work of course
> > >> _global['pkg1.pkg2.pkg3.className']();
> > >>
> > >> but this work:
> > >> _global['pkg1']['pkg2']['pkg3']['className']();
> > >>
> > >> can this done automatcally? i want jsut read string from XML and
> > >> create new class instance,
> > >> but i cant do it now.
> > >> Any help is appreciated :)
> > >>
> > >> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
> > >> Franto
> > >>
> > >> http://blog.franto.com
> > >> http://www.flashcoders.sk
> > >> _______________________________________________
> > >> Flashcoders mailing list
> > >> Flashcoders@chattyfig.figleaf.com
> > >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > >>
> > > _______________________________________________
> > > Flashcoders mailing list
> > > Flashcoders@chattyfig.figleaf.com
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > > _______________________________________________
> > > Flashcoders mailing list
> > > Flashcoders@chattyfig.figleaf.com
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > _______________________________________________
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
> --
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
> Franto
>
> http://blog.franto.com
> http://www.flashcoders.sk
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to