- Home /
FormatException: Input string was not in the correct format
Hey, I'm having a problem with my XML file, and my Javascript file connected to it. Right now, I have a series of cubes being spawned with my XML file, like so:
the waves are inside <> brackets.. waves wave 0 /wave wave 0,0 /wave wave 1 /wave /waves
This is what should be spawning; One basic cube (0), two basic cubes (0,0), and one advanced cube (1)
The problem I'm having is that my monster spawn will not spawn properly if there is more than one element in the XML wave (0,0). The error is here
var monsterSpawnIndex:uint = parseInt( currentWave.indexString );
It seems to me that my parseInt is not being used correctly, but I don't know what's wrong. :\
Answer by Eric5h5 · Apr 30, 2012 at 12:21 AM
parseInt can only parse numbers; other characters will cause it to fail like that.
0 $$anonymous$$y string passes variable 0 and 1 though. I'm not passing anything but an Int in the string/array that it is attached to.
Clearly there's some character in the string which is not a number. Otherwise you wouldn't get that exception.
I still can't find it. It's hidden somewhere in the code.. Thanks for trying to help.