Okay here's the actionscript I am dealing with:
Code:
stop();
var NumChoice1 = undefined;
var NumChoice2 = undefined;
var NumChoice3 = undefined;
var NumChoice4 = undefined;
var TotalVotes = undefined;
poll_xml = new XML();
poll_xml.contentType = "text/xml";
poll_xml.ignoreWhite = true;
poll_xml.load('poll.xml');
function onResults() {
NumChoice1 = poll_xml.firstChild.childNodes[0].firstChild.nodeValue.toString;
NumChoice2 = poll_xml.firstChild.childNodes[1].firstChild.nodeValue;
NumChoice3 = poll_xml.firstChild.childNodes[2].firstChild.nodeValue;
NumChoice4 = poll_xml.firstChild.childNodes[3].firstChild.nodeValue;
TotalVotes = NumChoice1 + NumChoice2 + NumChoice3 + NumChoice4;
trace ("TotalVotes = " + TotalVotes);
nextFrame();
}
And here's the xml I'm dealing with:
PHP Code:
<Choices url="http://kungfudrew.com/poll.xml">
<choice1>20</choice1>
<choice2>2</choice2>
<choice3>3</choice3>
<choice4>4</choice4>
</Choices>
Now the trace TotalVotes will give me 20234 instead of 29. How can I convert these values (NumChoiceX) to numeric values?