Sending data from processing to arduino

Hi guys,

Thanks for all your help so far. I'm trying to use the atoi function as suggested by PaulS, but I'm having some problems.
I've decided to send the data from Processing to the arduino in this format: "127,255" with 127 and 255 being the speeds of the left and right motor respectively, so it only sends one bunch of serial data for both motors.

This may sound a bit cheeky, but can you see any problems with my code, unfortunately I don't have my Arduino at home at the moment, and I'm dying to know whether it will work!

#include <AFMotor.h>
AF_DCMotor rightmotor1(1);
AF_DCMotor rightmotor2(3);
AF_DCMotor leftmotor1(2);
AF_DCMotor leftmotor2(4);

String leftmotor;
String rightmotor;

int Leftmotor;
int Rightmotor;

int index = 0;
String serialval = "";
char inChar;

void setup() {

Serial.begin(9600);
rightmotor1.setSpeed(0);
rightmotor2.setSpeed(0);
leftmotor1.setSpeed(0);
leftmotor2.setSpeed(0);
}

void loop() {

while (Serial.available() > 0) {  
inChar = (char)Serial.read();
serialval += inChar;
}

index = serialval.indexOf(",");

leftmotor =  serialval.substring(0, index);
rightmotor = serialval.substring(index + 1);

Leftmotor = leftmotor.toInt();
Rightmotor = rightmotor.toInt();

rightmotor1.setSpeed(Rightmotor);
rightmotor2.setSpeed(Rightmotor);
leftmotor1.setSpeed(Leftmotor);
leftmotor2.setSpeed(Leftmotor);
}