RE: [Flashcoders] Create an object by name

2007-03-21 Thread Danny Kodicek
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: xmlitem type='Big' size='3' /item

Re: [Flashcoders] Create an object by name

2007-03-20 Thread Ron Wheeler
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: xmlitem type='Big' size='3' /item type='Small'

Re: [Flashcoders] Create an object by name

2007-03-19 Thread Paul Andrews
- Original Message - From: Danny Kodicek [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Monday, March 19, 2007 10:08 AM Subject: [Flashcoders] Create an object by name If I have a string, how can I make an object from the class it represents? Eg: I have class

Re: [Flashcoders] Create an object by name

2007-03-19 Thread Ian Thomas
Hello Danny, This short snippet should return you the constructor: /** Returns the class constructor from a dotted path. * e.g. [EMAIL PROTECTED] var cons:Function=getConstructorFromPath(com.pkg.fred.Bucket); } */ public static function

RE: [Flashcoders] Create an object by name

2007-03-19 Thread Danny Kodicek
Hello Danny, This short snippet should return you the constructor: /** Returns the class constructor from a dotted path. * e.g. [EMAIL PROTECTED] var cons:Function=getConstructorFromPath(com.pkg.fred.Bucket); } */ public static function

RE: [Flashcoders] Create an object by name

2007-03-19 Thread Danny Kodicek
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

Re: [Flashcoders] Create an object by name

2007-03-19 Thread Ian Thomas
Hi Danny, An import statement is just a compiler-friendly shortcut. It has no effect whatsoever on the final code. Saying: import com.pkg.fred.Bucket; // later var bucket:Bucket=new Bucket(); is identical to saying just: var bucket:com.pkg.fred.Bucket=new com.pkg.fred.Bucket(); That's all

Re: [Flashcoders] Create an object by name

2007-03-19 Thread Paul Andrews
- Original Message - From: Danny Kodicek [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com I'm still not entirely sure what import actually *does* :) It tells flash where the class definitions can be found and distinguishes between classes of the same name, but different

RE: [Flashcoders] Create an object by name

2007-03-19 Thread Karina Steffens
Kodicek [mailto:[EMAIL PROTECTED] Sent: 19 March 2007 11:45 To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] Create an object by name Hello Danny, This short snippet should return you the constructor: /** Returns the class constructor from a dotted path. * e.g

Re: [Flashcoders] Create an object by name

2007-03-19 Thread Hans Wichman
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

Re: [Flashcoders] Create an object by name

2007-03-19 Thread Ian Thomas
On 3/19/07, Ian Thomas [EMAIL PROTECTED] wrote: That's all it is. A convent bit of syntactic sugar. It's exactly the same in Java. Um... _convenient_, obviously. Although that does conjure up some wacky images... Ian ___

RE: [Flashcoders] Create an object by name

2007-03-19 Thread Danny Kodicek
Hi Danny, An import statement is just a compiler-friendly shortcut. It has no effect whatsoever on the final code. Saying: import com.pkg.fred.Bucket; // later var bucket:Bucket=new Bucket(); is identical to saying just: var bucket:com.pkg.fred.Bucket=new

RE: [Flashcoders] Create an object by name

2007-03-19 Thread Danny Kodicek
I'm still not entirely sure what import actually *does* :) It tells flash where the class definitions can be found and distinguishes between classes of the same name, but different packages. You seem to be in a mega hurry Danny! I've been working on my current task for about nine

RE: [Flashcoders] Create an object by name

2007-03-19 Thread Danny Kodicek
I'm still not entirely sure what import actually *does* :) It tells flash where the class definitions can be found and distinguishes between classes of the same name, but different packages. You know, it occurs to me that import is an astonishingly bad name for this statement. Poorly

Re: [Flashcoders] Create an object by name

2007-03-19 Thread Paul Andrews
- Original Message - From: Danny Kodicek [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Monday, March 19, 2007 2:36 PM Subject: RE: [Flashcoders] Create an object by name I'm still not entirely sure what import actually *does* :) It tells flash where the class

RE: [Flashcoders] Create an object by name

2007-03-19 Thread Steven Sacks | BLITZ
Most of the time, what I've seen is setting a temporary var to either an instance of the class, or in the case of a static class, setting it to a reference to the class. var myClass:MyClass = new com.client.project.package.MyClass(); or var myClass:MyClass = com.client.project.package.MyClass; I