Switch&case

Hello… somebody know what’s wrong? Only use default value .-(


userClass = _root.userClass; //This is my class (7)

function msgGO(userClass:Number):Void
{
    switch(userClass)
    {
        case 1:
            socket.send("<b>["+userName+"]</b> "+uzenet.text);
            break;
        case 2:
            socket.send("<b>["+userName+"]</b> "+uzenet.text);
            break;
        case 3:
            socket.send("<b><font color=\"#FF6600\">["+userName+"]</b></font> "+uzenet.text);
            break;
        case 4:
            socket.send("<b>["+userName+"]</b> "+uzenet.text);
            break;
        case 5:
            socket.send("<b><font color=\"#3399FF\">["+userName+"]</b></font> "+uzenet.text);
            break;
        case 6:
            socket.send("<b>["+userName+"]</b> "+uzenet.text);
            break;
        case 7:
            socket.send("<b><font color=\"#FFFFFF\">["+userName+"]</b></font> "+uzenet.text);
            break;
        default:
            socket.send("<b>["+userName+"]</b>"+userClass+" "+uzenet.text);
    }
    uzenet.text = '';
}

Key.removeListener(this);
this.onKeyDown = function() {
   if (Key.isDown(Key.ENTER)) {
      msgGO(userClass);
   }
};
Key.addListener(this);

Thanks

Try replacing the switch line with

switch(Number(userClass))

do a trace on your userclass, are they spitting out number or something else.

if this was a if statement what would u have done?