This content has been marked as final. Show 4 replies
Just to sum up... when I use CurrentImage = this._name.toString().substring(4) to set CurrentImage, and CurrentImage is between 5 and 9, the if statement does not calculate correctly... if I were to use the same method, and CurrentImage was 27, everything would work... just not with the numbers 5,6,7,8,or 9..
In your last method of calculating CurrentImage, CurrentImage becomes a String and not a number. And so, it does the comparison in an alphabetic manner, ie see which first digit is less, if same, next digit, etc. So, "46" would be less than "7" because 4<7. To remedy, use the Number conversion function:
CurrentImage = Number(this._name.toString().substring(4));
It gives the numerical value of the given expression.
Yeah, sorry, I solved it last night, I figured out that I needed to use Number(this._name.toString().substring(4))
Thanks for helping out