Hi,
new eval("_global.mypackage.MyClass") does the trick as well I believe.
greetz
JC
On 3/19/07, Danny Kodicek <[EMAIL PROTECTED]> wrote:
> > If I have a string, how can I make an object from the class
> it represents?
> > Eg:
> >
> > I have class MyBigClass
> > the string className contains the text "Big"
> >
> > I want to do something like
> > obj:Object = new("My" + className + "Class")()
>
Paul:
> Might be interesting to know why you need to do this at all.
I'm using an XML document to create a file. Without going into details,
each
node of the XML is to be turned into an object, based on the kind of node.
So for example:
<xml><item type='Big' size='3' /><item type='Small' size='2'></xml>
This would become two objects, one an instance of MyBigClass, one an
instance of MySmallClass. In an old version of this, each one was a
MovieClip with the appropriate linkage name. Now I'm trying to do it more
flexibly with objects (so that in particular, each object type can inherit
a
standard class, and so that I don't have to have a separate movieClip for
each object type).
Danny
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com