Hi everyone, it's my first time posting to the board.

I'm trying to figure something out, or if it's even possible.  I would like
to dynamically instantiate a class (via getDefinitionByName) but without
explicitly instantiating the object prior in the class.

An example (this is what I would like to be able to do):

package
{
    import com.sweet.*;
    import flash.utils.getDefinitionByName;

    public class Foo
    {
        public function Foo()
        {
             classRef = getDefinitionByName("com.sweet.SomeSweetClass") as
Class;
             var mySweetness:Object = new classRef();
        }
     }
}

I figured that the import would take care of it, but it doesn't.  I have to
do at least one 'var ssc:SomeSweetClass = new SomeSweetClass();' and then it
will work.  If not, then I get a reference error like:
ReferenceError: Error #1065: Variable SomeSweetClass is not defined.

Is there any way to do this with Run-Time libraries, or some directive or
metadata or something?  Or is there something really obvious that I'm
missing?

t.i.a!

-- 
Rick Terrill
- www.rickterrill.com
- www.linkedin.com/in/rickterrill
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

Reply via email to