PDA

View Full Version : [MX] CharAt Probs.. Fast Help Please!!



phorte
July 12th, 2003, 04:44 AM
Well I have an example here for you and I want to know why it doesnt work?? And how can i make it work??
//Initial Number
myNumber = 512
//Add 10 to the number
myNumber += 10

//Trace the Number
trace(myNumber)
//Trace the character at 1 in the number
trace(myNumber.charAt(1))

The Output looks like this:
522
undefined


Thanks in advance..

-Scotty..

ahmed
July 12th, 2003, 04:58 AM
try
myString = myNumber.toString();
trace(myString.charAt(1))

fluid_0ne
July 12th, 2003, 07:43 AM
yep
you should convert number into string in the 1st place cuz charAT is for strings only :thumb: