Hello everyone !
Explanation:
I have a xmlfile with some node. I need to create an object of my class for each node. I knoz how to parse xml and get value, no problem here, but I can’ create dynamic object with dynamic name…
here’s my class code:
public class Simple_Forum_MV extends MovieClip{
**public function Simple_Forum_MV(MV_name:??,title_forum:String,description_forum:String)
{
MV_name:MovieClip = new MovieClip();**
MV_name.width = 500;
MV_name.height = 50;
var a_title:Label = new Label();
var a_description:Label = new Label();
a_title.text = title_forum;
a_description.text = description_forum;
MV_name.addChild(a_title);
MV_name.addChild(a_description);
}
}
here is my main file code:
function onXmlLoaded(evt:Event)
{
var lists:XML = new XML( evt.target.data );
var forums:XMLList = lists.elements();
var forum_name = 0;
for each(var forum:XML in forums)
{
**this["MVforum"+forum_name] = new Simple_Forum_MV(**??**,forum.TITLE,forum.DESCRIPTION);**
this["MVforum"+forum_name].name = "MVforum" + forum_name;
container.source = this["MVforum"+forum_name];
forum_name++;
}
}
Can I get some help ?
Thanks !