How to use this parseFloat() number?

I have this to build my nav;


// navigation
var picNum:Number = 3;
for (var i = 1; i<=picNum; i++) { 
	_root.nav["btn"+i].topText_mc.text = *;
	_root.nav["btn"+i].alphaTo(30, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
}

My XML:
What I want is to get this trace(parseFloat(i)); to be my picNum variable. Tried a bunch of diffrent things but none worked. Maybe someone here knows?


var pArray = new Array();
var tArray = new Array();

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (success:Boolean):Void {
    if (success) {
        var xmlData = this.firstChild.childNodes[0].childNodes[0];
		for (var i = 0; i<xmlData.childNodes.length; i++) {
			pArray.push(xmlData.childNodes*.childNodes[0].firstChild.nodeValue);
			tArray.push(xmlData.childNodes*.childNodes[1].firstChild.nodeValue);
        }
		trace(parseFloat(i));
		containerMC.loadPic(0);
		picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
    } else {
        picInfo.text = "Unable to load external file.";
    }
}
myXML.load("xml/XMLdata.xml")

i is already an integer, but it’s only available inside the for loop, that’s how for loops work.
Do you need it to be a float? Do you want access to i outside of the for loop? What, exactly, are you trying to accomplish?

I just solved my problem. Thanks anyway. What I was trying to do was to get the number of nodes populated with images in my xml file to setup my navigation. This is how I did it with the use of [COLOR=“Blue”]parseInt()[/COLOR]:


var pArray = new Array();
var tArray = new Array();

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (success:Boolean):Void {
    if (success) {
        var xmlData = this.firstChild.childNodes[1].childNodes[2]; // sub1 = 0
		for (var i = 0; i<xmlData.childNodes.length; i++) {
			pArray.push(xmlData.childNodes*.childNodes[0].firstChild.nodeValue);
			tArray.push(xmlData.childNodes*.childNodes[1].firstChild.nodeValue);
        }
		// navigation
		var picNum = parseInt(i);
		for (var i = 1; i<=picNum; i++) { 
			_root.nav["btn"+i].topText_mc.text = *;
			_root.nav["btn"+i].alphaTo(30, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			}
			_root.nav.btn1.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			_root.nav.btn1.enabled = false;
		// load pictures
		containerMC.loadPic(0);
		picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
    } else {
        picInfo.text = "Unable to load external file.";
    }
}
myXML.load("xml/XMLdata.xml")

Hmm, sorry but I thought I had it. :frowning: A slightly diffrent question but in the same category, I think… jow can I make this work with my xml file? Can I make the childNodes* get different values? The first one for the <subnumber> and the second one for the <subinfo> tags?

In flash:


var pArray = new Array();
var tArray = new Array();

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (success:Boolean):Void {
    if (success) {
        var xmlData = this.firstChild;
		for (var i = 0; i<xmlData.childNodes.length; i++) {
			pArray.push(xmlData.childNodes*.childNodes*.childNodes[0].firstChild.nodeValue);
			tArray.push(xmlData.childNodes*.childNodes*.childNodes[1].firstChild.nodeValue);
        }
		// navigation
		var picNum = parseInt(i);
		for (var i = 1; i<=picNum; i++) { 
			_root.nav["btn"+i].topText_mc.text = *;
			_root.nav["btn"+i].alphaTo(30, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			}
			_root.nav.btn1.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
			_root.nav.btn1.enabled = false;
		// load pictures
		containerMC.loadPic(0);
		picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
    } else {
        picInfo.text = "Unable to load external file.";
    }
}
myXML.load("main1/xmlData.xml")

And my xml:


<?xml version="1.0" encoding="iso-8859-1" ?>
<main>
	<subnumber><!-- SUB 1 -->
		<subinfo>
			<path>main1/images1/01.jpg</path>
			<info><![CDATA[<p>main1, sub1</p>]]></info>
		</subinfo>
		<subinfo>
			<path>main1/images1/02.jpg</path>
			<info></info>
		</subinfo>
		<subinfo>
			<path>main1/images1/03.jpg</path>
			<info></info>
		</subinfo>
	</subnumber>
	<subnumber><!-- SUB 2 -->
		<subinfo>
			<path>main1/images2/01.jpg</path>
			<info><![CDATA[<p>main1, sub2</p>]]></info>
		</subinfo>
		<subinfo>
			<path>main1/images2/02.jpg</path>
			<info></info>
		</subinfo>
	</subnumber>
</main>