# Creating Classes from DataBase (xml)

**URL:** <https://forum.kirupa.com/t/creating-classes-from-database-xml/323776>\
**Category:** flash\
**Created:** [July 17, 2011, 8:36pm UTC](https://forum.kirupa.com/t/creating-classes-from-database-xml/323776 "2011-07-17T20:36:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bontempos](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@bontempos](https://forum.kirupa.com/u/bontempos)\
**Post date:** [July 17, 2011, 8:36pm UTC](https://forum.kirupa.com/t/creating-classes-from-database-xml/323776/1 "2011-07-17T20:36:56Z")

</div>

Hi everyone

Short explanation:  
-\>\>\>  
So. I have an xml with this:

```auto
<apps>
   <app id="1" name="CustomClass01"/>
   <app id="..." name="..."/>
</apps>

```

These Classes are stored inside a package, lets say: “apps”.

Normally, I’d use:

```auto
import apps.*
var _app01:CustomClass01 = new CustomClass01

```

and there it goes.  
But what to do when I don’t have control over the class name nor I can’t create dummys or instances before loading the xml?  
If I have 1000 classes I can’t create cons with all those classes…

Long explanation:

I have spent all the afternoon trying to look for a solution and I’ve found very old foruns talking about the use of “getDefinitionByName”.

However it returns undefined, since the class has not instances.  
There is a use including a “dummy” process, where you include the name of the Class before creating its instance.

But in my case I’m bring the Class name from an xml.  
I have found also something similar at forums, but answers didn’t apply.

Can I use this structure? I’m not sure how to proceed here =/

```auto

import apps.*
var className:String = apps[id].cls; // outputs "CustomClass01". Also tried "apps.CustomClass01".
var appClass:Class = getDefinitionByName(className) as Class;
var app = new screenClass;

```

Thanks in advance
