# Switch - Button problem

**URL:** https://forum.kirupa.com/t/switch-button-problem/229531
**Category:** flash
**Created:** [June 18, 2007, 10:15am UTC](https://forum.kirupa.com/t/switch-button-problem/229531 "2007-06-18T10:15:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kavu](https://avatars.discourse-cdn.com/v4/letter/k/3be4f8/32.png) [@kavu](https://forum.kirupa.com/u/kavu)
#### Post date: [June 18, 2007, 10:15am UTC](https://forum.kirupa.com/t/switch-button-problem/229531/1 "2007-06-18T10:15:26Z")

</div>

Hi

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

so i got this code:

```auto

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 😕

Thx
