# Class And Dynamique vars

**URL:** https://forum.kirupa.com/t/class-and-dynamique-vars/181780
**Category:** flash
**Created:** [March 13, 2006, 1:20am UTC](https://forum.kirupa.com/t/class-and-dynamique-vars/181780 "2006-03-13T01:20:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![woyrz](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@woyrz](https://forum.kirupa.com/u/woyrz)
#### Post date: [March 13, 2006, 1:20am UTC](https://forum.kirupa.com/t/class-and-dynamique-vars/181780/1 "2006-03-13T01:20:19Z")

</div>

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
