Reputation: 2623
I want to put shortest int in shortest
:
shortest = 500;
for(i = 1; i <= _global.var_process_count; i++)
{
if(_root["process" + i].process_time_original.text < shortest)
shortest = _root["process" + i].process_time_original.text ;
}
what's wrong with above lines of code?
Upvotes: 0
Views: 112
Reputation: 59451
textfield.text
) to a Number
.Try the following code:
var shortest:Number = Number.MAX_VALUE;
for(i = 1; i <= _global.var_process_count; i++)
{
var t:Number = Number(_root["process" + i].process_time_original.text);
if(isNaN(t)) //in case the text is not a valid number.
continue;
if(t < shortest)
shortest = t;
}
trace("shortest number is " + shortest);
Upvotes: 2