Mimic button's behavior with MC and keyboard

In an application driven by keyboard only, I would like to mimic the behavior of buttons…with movieclips!
That means to have the equivalent of the “over”,“selected” and “unselected” states.
Plus, I would like the MC to trigger an action when it’s in the selected state.
To finish, I need a way to “speak” to the buttons…so that I can set it to its last state when recalled later.

What I did for now is:
Group the buttons belonging to the same familly into one and only button.
This button contains as many frames than buttons in the “familly”, each frame corresponding to the “selected” state of the button.
(it’ll be more clear with the file joined here :wink:

So, for example, my button1 actually contains the representation of 2 buttons: on & off. On frame 1 the button “on” is drawn as selected…and on frame 2 the button “off” is drawn as unselected.
That way, it’s simply a matter of telling goto(1) to have button “on” selected…and goto(2) to have button “off” selected.

I navigate through set of buttons with an array (going up and down with the arrow keys to move through the sets).

The problem IS: I would like to have a “over” state, giving me a feedback of where I am in my button’s set.
So, I think that I would need a system where I can browse through the buttons and have a visual feedback of it.
Then, use another key on the keyboard that would select(unselect) the button…and doing the inverse with the other buttons of the set.
Please would you have an idea…or adaptation of my idea to help me?
Thanks very much!


var myMap:Array = new Array("btn0", "btn1");
var lenghtmenu:Number = myMap.length;
var posmenu:Number = 0;
//
function menuDown() {
 // Left
 if (Key.getCode() == 37) {
  menu[myMap[posmenu]].prevFrame();
 }
 // Right         
 if (Key.getCode() == 39) {
  menu[myMap[posmenu]].nextFrame();
 }
 // Up         
 if (Key.getCode() == 38 && posmenu-1>=0) {
  posmenu--;
 }
 // Down         
 if (Key.getCode() == 40 && posmenu+1<lenghtmenu) {
  posmenu++;
 }
}
var keyListener:Object = new Object();
keyListener.onKeyDown = menuDown;
Key.addListener(keyListener);