Switch - Button problem

Hi

I want to make a simple SWITCH statement with Button._name as variables for CASE

so i got this code:


Button.addListener(_root);
_root.onRelease = function() {


switch(Button._name) {
    case "name1" :
    trace("name1");
    break;
    
    case "name2" :
    trace("name2");
    break;
    
    case "name3" :
    trace("name3");
    break;
    
}
}

and Im receiving error:

The property being referenced does not have the static attribute.
for switch(Button._name)

Anyone knows what is the problem?
for Key instead of Button it works fine :confused:

Thx