var ClassReference : Class = getDefinitionByName("mx.controls.ComboBox") as Class; var displayObject : DisplayObject = new ClassReference(); addChild(displayObject);
--- In flexcoders@yahoogroups.com, keith <[EMAIL PROTECTED]> wrote: > > I want to convert something like the String "mx.controls.ComboBox" to a > Class. > I would use this to declare components or other classes at runtime. > *Please don't laugh at me* > > //============================== > //In areas where I CAN do this... > //--------------------------------------------- > var testA:* = new mx.controls.ComboBox(); > addChild(testA); > //============================== > > //===================================== > //I want to DYNAMICALLY do the same... > //-------------------------------------------------------- > var classname:Class = Class("mx.controls.ComboBox"); > var testB:* = new classname(); > addChild(testB); > //===================================== > > //But get a this type of error---> TypeError: Error #1034: Type Coercion > failed: cannot convert "mx.controls.ComboBox" to Class. > > > -- Keith H -- >