[haXe] Building classes dynamically

Gerry Fontaine gnfontaine at gmail.com
Thu Apr 12 21:56:58 CEST 2007


I am not even sure this is possible however it would same me piles of 
lines of code.
I am trying to write a class which will parse xml and dynamically build 
the components based on xml content.

It all works using case statements, however I would like to make it more 
robust.
I have tried using Reflect however its seems like I just don't get it.

This is what I am trying to do

import someclasses

function createInstance( fp_instanceName:String){

// I do not know how to use the string passed in the argument to create 
an instance of the class
var obj = new fp_instanceName();

// now I can access the fields to the class...
Reflect.hasField('SomeProperty');

}

Thanks for any help, once I get this working I will be posting the code
Its a complete set of dynamic UI components.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gnfontaine.vcf
Type: text/x-vcard
Size: 183 bytes
Desc: not available
Url : http://lists.motion-twin.com/pipermail/haxe/attachments/20070412/6a4559b5/gnfontaine.vcf


More information about the Haxe mailing list