Meksika
18.11.2007, 20:17
Здравствуйте... Не могли бы Вы подсказать, в чем заключается проблема?
Есть ХМЛ:
<circle1>
<color>1</color>
<desc>This is the first description</desc>
</circle1>
<circle2>
<color>2</color>
<desc>asd</desc>
</circle2>
<circle3>
<color>3</color>
<desc>zxc</desc>
</circle3>
А также АС:
conf_xml = new XML();
conf_xml.load("conf.xml");
myXML.parseXML(conf_xml);
conf_xml.ignoreWhite = true;
n = 3;
var col = new Array(n);
var desc = new Array(n);
conf_xml.onLoad = function(st)
{
if(st)
{
for(i in conf_xml.childNodes)
{
cir = conf_xml.childNodes[i];
col[i] = cir.childNodes[0].childNodes[0];
desc[i] = cir.childNodes[1].childNodes[0];
trace(i+": "+col[i]+","+desc[i]);
desc_out.text = desc[0];
}
}
else trace("Error while opening XML");
};
Как вытащить переменную desc[0], для работы вне цикла?
Очень надеюсь на вашу помощь. Заранее спасибо....:umnik2:
Есть ХМЛ:
<circle1>
<color>1</color>
<desc>This is the first description</desc>
</circle1>
<circle2>
<color>2</color>
<desc>asd</desc>
</circle2>
<circle3>
<color>3</color>
<desc>zxc</desc>
</circle3>
А также АС:
conf_xml = new XML();
conf_xml.load("conf.xml");
myXML.parseXML(conf_xml);
conf_xml.ignoreWhite = true;
n = 3;
var col = new Array(n);
var desc = new Array(n);
conf_xml.onLoad = function(st)
{
if(st)
{
for(i in conf_xml.childNodes)
{
cir = conf_xml.childNodes[i];
col[i] = cir.childNodes[0].childNodes[0];
desc[i] = cir.childNodes[1].childNodes[0];
trace(i+": "+col[i]+","+desc[i]);
desc_out.text = desc[0];
}
}
else trace("Error while opening XML");
};
Как вытащить переменную desc[0], для работы вне цикла?
Очень надеюсь на вашу помощь. Заранее спасибо....:umnik2: