Hey all,
I have taken a bottle of Excedrin due to the headache I’ve developed from this problem I am having. I have some variables:
[AS]
var snd1:Sound = new Sound(this);
var snd2:Sound = new Sound(this);
var snd3:Sound = new Sound(this);
var snd4:Sound = new Sound(this);
var snd5:Sound = new Sound(this);
var snd6:Sound = new Sound(this);
var snd7:Sound = new Sound(this);
var snd8:Sound = new Sound(this);
var snd9:Sound = new Sound(this);
var snd10:Sound = new Sound(this);
var snd11:Sound = new Sound(this);
var snd12:Sound = new Sound(this);
var snd13:Sound = new Sound(this);
[/AS]
And I do not want to hard-coded them, but increment via length from an XML childNode.
My code:
[AS]
var snd:Array = [];
var templateXML:XML = new XML();
templateXML.ignoreWhite = true;
templateXML.load(“safety.xml”);
templateXML.onLoad = function(p_success:Boolean):Void
{
if(p_success)
{
//Working on the sound array in the XML file.
xmlLen = templateXML.firstChild.childNodes[0].childNodes.length;
_Vars();
}
}
function _Vars()
{
trace("xmlLen value is: " + xmlLen);
for(i = 1; i < xmlLen; i++)
{
var snd*:Sound = new Sound(snd*);
trace(snd*);
}
}
[/AS]
Is giving me errors. Any help on solving this would be greatly appreciated. Again, I would like to create variables based on the length of a childNode. The first part of the code from this post is what is current, the 2nd parts if kinda where I want it to go.
Thanks.