This content has been marked as final. Show 5 replies
use the Number() function.
Simple answer thanks Kglad.
but can you tell me why it was not a Number to begin with?
here is the line of code
var nextT:Number = nextObjTimeMarker.timeMarker + 5;
results in 1115
It is now written as the following even though i consider it redundant.
var nextT:Number = Number( nextObjTimeMarker.timeMarker ) + 5;
results in 116
all "numbers" loaded by flash from text or xml files are really strings. so any addition you do with them will be string addition.
you should cast that string as a number once, and then you don't have to do that again:
var x:Number = Number( nextObjTimeMarker.timeMarker );
var nextT:Number = x+5;
kglad, thank you so much for the response. I would never had thought that the value would be string inferred since the var was stong typed. I updated my code and things are working smoothly. Thanks again.
p.s. the as3 compiler would generate an error about not being able to coerce a string to a number. as2 just lets you have problems until you figure it out.