Setting up a keypad navigated button menu using an array

Hi there,

I’ve gotten code that would circle through this with menu without an array, but I have been looking trying to complete it for the sake of better learning about arrays.

I have 3 buttons and I want to use the up, down, arrow keys to cycle through the buttons. So far I have the code to switch the up state once they are clicked on but I am unsure how to incorporate the navigational aspect into the array and have it cycle through.

Below I have posted my file with actionscript. Here is the actionscript set up right now:


var buttons:Array = [“btn1”, “btn2”, “btn3”];

function buttonOver(pressed) {
for (var i = 0; i<buttons.length; i++) {
if (pressed == buttons*) {
this[buttons*].enabled = false;
} else {
this[buttons*].enabled = true;

btn1.onRelease = function ():Void {

btn2.onRelease = function ():Void {

btn3.onRelease = function ():Void {