Jump to content


XML passed number acts different than one created in java. ;(

Recommended Posts

Hi Jack and GS peeps,




I'm successfully using this tween below to animate a number gauge up and down depending on the value I pass into condition1a. The problem is when I pull the number in from XML it adds to the value already in the output field instead of sending the gauge to the proper number. I don't know why it acts differently when I pull in from XML. Do I have to tell java the number from XML is a string or somthing? Any ideas?


TweenMax.to(obj, .5, {value:condition1a, roundProps:["value"], ease:Linear.easeNone, onUpdate:function() {

output.innerHTML = obj.value;

output2.innerHTML = obj.value;

tl.tweenTo(condition1a); // < this timeline tweens to the correct place, only the output number adds incorrectly.




When I set my number gauge value variable like this is works fine:

window.condition1a = 27.28;



When I pull from XML like shown below its act differently.

var scenarioA1=xmlDoc.getElementsByTagName("ThroughputGauge");

window.condition1a = (scenarioA1.getElementsByTagName("scenarioA1")[0].childNodes[0].nodeValue);


When I trace the variable is comes up as 27.28 so I know the XML is getting the correct number into the function.




XML structure sample:






How do I get the XML passed variable to act the same as the one I set in java? Thanks everyone!

Link to comment
Share on other sites

I need to convert the xml string to a literal number using parseInt():, that sound right Jack? :D

Link to comment
Share on other sites

Ok I got it.  Thanks for listening! 


var scenarioA2=xmlDoc.getElementsByTagName("ThroughputGauge");

var condition2a = parseFloat((scenarioA2.getElementsByTagName("scenarioA2")[0].childNodes[0].nodeValue));
window.condition2a = condition2a;
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.