I have a probleme calling variable dynamicly in a class. I want to over write some wars using a Xml that is have load externaly. here is the example
If i go and type in the name of the vars it’s work. it over write the var “nom”. see following:
[AS]
class profil {
public var nom = “test”;
public function loadProfil(no_sercuriteParam:String, profilXml:XML) {
var i:Number = 0;
while (profilXml.childNodes[0].childNodes[0].childNodes*.nodeName) {
trace(profilXml.childNodes[0].childNodes[0].childNodes*.nodeName+"=>"+profilXml.childNodes[0].childNodes[0].childNodes*.firstChild.nodeValue);
var varName:String= “nom”;
var profildata:String = this[profilXml.childNodes[0].childNodes[0].childNodes*.firstChild.nodeValue];
//this[varName]= profildata;
this[varName]= “fdskfjdskl”;
trace(this[varName]);
++i;
}
_root.gotoAndStop(“showProfil”);
fillfields();
}
[/AS]
My probleme is that im loading a Xml to call all my vars and i can’t over write the var “nom”
[AS]
class profil {
public var nom = “test”;
public function loadProfil(no_sercuriteParam:String, profilXml:XML) {
var i:Number = 0;
while (profilXml.childNodes[0].childNodes[0].childNodes*.nodeName) {
trace(profilXml.childNodes[0].childNodes[0].childNodes*.nodeName+"=>"+profilXml.childNodes[0].childNodes[0].childNodes*.firstChild.nodeValue);
var varName:String= this[profilXml[profilXml.childNodes[0].childNodes[0].childNodes*.nodeName]];
var profildata:String = this[profilXml.childNodes[0].childNodes[0].childNodes*.firstChild.nodeValue];
this[varName]= “fdskfjdskl”;
trace(this[varName]);
++i;
}
_root.gotoAndStop(“showProfil”);
fillfields();
}
}
[/AS]
i have no clue of what could be the problem