Keyboard and buttons

I am creating a TV remote. I have buttons 0-9. I would like to be able to use the arrow keys to move between the numbered buttons and then hit enter to select them. I would like all the normal funcions of the different button states (up, over, down) to still work. When the button is pressed, I would like to have an external swf file load. I know how to do this part, just not the arrow keys. I have read a couple tutorials on moving objects with arrows, but I would like mine to be stationary.

Also, when you select a button, I would like a display to show the number you selected, and be able to do double digits. Like a real TV remote. So, pressing 1, gives you a 1. Then arrow to 9, select it, and the display reads 19. Then it loads the “channel” or swf file.

Thanks

Ok…this is going to require something similiar to a tile-based RPG. I do not master in tile-based RPGs, but rather in art-based. So I cannot help you unless I figure out something. But right now, I have shat-loads of homework and I am tired from baseball and crap today. I will be back on tomarrow and hopefully I will have a code. So hold on, you’ll get your code soon!

Alright, I came up with it earlier than I would think I can. This is to select and put in all of the information. The catch is, that I couldn’t find a way to make the buttons change different colors or anything. Really, all this script does, it just uses the array I made, and has nothing to do with the movie clips. Here is the code I have so far:

//Put this all in the current frame that will hold your buttons
var row:Number = 0;
var col:Number = 0;
var btnpad:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
function enterInfo(num:Number):Void {
    if (Key.isDown(13)) {
        if (txt+num<100) {
            txt += num;
        } else {
            txt = "";
            txt += num;
        }
    }
}
function switchBtns():Void {
    if (Key.isDown(37)) {
        col--;
    } else if (Key.isDown(38)) {
        row--;
    } else if (Key.isDown(39)) {
        col++;
    } else if (Key.isDown(40)) {
        row++;
    }
    if (row<0) {
        row = 0;
    }
    if (row>2) {
        row = 2;
    }
    if (col<0) {
        col = 0;
    }
    if (col>2) {
        col = 2;
    }
    enterInfo(btnpad[row][col]);
}
onEnterFrame = function () {
    switchBtns();
};

I will try to make the part that makes the selected button and I will post it on here. Hope I helped…even more!

------------------------UPDATE-------------------------------
I have fixed it. Put in the code below in the current frame, as you did in the above script I proposed. Now have every MovieClip in your pad labeled with the instance names from “1-9” depending on the button it is(for example, for button 1, it would have the instance “1”, and so on…). Then, put in the second script I will supply you(below the one below this text), in each of the MovieClips that you have on stage. Here is the _root frame script:

var row:Number = 0;
var col:Number = 0;
var btnpad:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
function checkSelection(mc:MovieClip):Void {
    if (mc._name == btnpad[row][col]) {
        mc.gotoAndStop(2);
    } else {
        mc.gotoAndStop(1);
    }
}
function enterInfo(num:Number):Void {
    if (Key.isDown(13)) {
        if (txt+num<100) {
            txt += num;
        } else {
            txt = "";
            txt += num;
        }
    }
}
function switchBtns():Void {
    if (Key.isDown(37)) {
        col--;
    } else if (Key.isDown(38)) {
        row--;
    } else if (Key.isDown(39)) {
        col++;
    } else if (Key.isDown(40)) {
        row++;
    }
    if (row<0) {
        row = 0;
    }
    if (row>2) {
        row = 2;
    }
    if (col<0) {
        col = 0;
    }
    if (col>2) {
        col = 2;
    }
    enterInfo(btnpad[row][col]);
}
onEnterFrame = function () {
    switchBtns();
};

Here is the second script, to be put in each of the movieclips:

onClipEvent (enterFrame) {
    _root.checkSelection(this);
}

There, I hope I helped you solve your problem. If you still have problems, I will upload my .fla for you to see. Good luck on your…remote for your TV, lol!

Ok. This is what I did. I have a empty movie clip on the stage that I would like to load all the files into. I clicked on clip, with the instance name of “empty,” and put your second code for the movie clip in.

On my action script layer, I entered the first script you gave me. I entered the movie clip name. Now when I test the movie, it is giving me action scripting error. It reads:

Error Scene=Scene 1, layer=A, frame=1:Line 5: The class ‘empty’ could not be loaded.
function checkSelection(mc:empty):Void {
Total ActionScript Errors: 1 Reported Errors: 1

Here is the action script I put in for the buttons:

var row:Number = 0;
var col:Number = 0;
var btnpad:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
function checkSelection(mc:empty):Void {
if (mc._empty == btnpad[row][col]) {
mc.gotoAndStop(2);
} else {
mc.gotoAndStop(1);
}
}
function enterInfo(num:Number):Void {
if (Key.isDown(13)) {
if (txt+num<100) {
txt += num;
} else {
txt = “”;
txt += num;
}
}
}
function switchBtns():Void {
if (Key.isDown(37)) {
col–;
} else if (Key.isDown(38)) {
row–;
} else if (Key.isDown(39)) {
col++;
} else if (Key.isDown(40)) {
row++;
}
if (row<0) {
row = 0;
}
if (row>2) {
row = 2;
}
if (col<0) {
col = 0;
}
if (col>2) {
col = 2;
}
enterInfo(btnpad[row][col]);
}
onEnterFrame = function () {
switchBtns();
};

I attached my .fla file

Ok. I fixed the action script error, I shouldn’t have put the movie clip name (mc:MovieClip), so that is fixed. However, the file still doesn’t do anything when I use the keyboard.

Here, this is the .fla I used, go ahead and analyze how I did it. Then you can optimize to what you want. I tried, sorry…

Sorry, I can’t open the file. It says unexpected file format.

download it again as this sometimes happerns when downloading the files, i have just tryied it and works ok.

Well…it’s flash 8…Do you have flash MX PRO?

nope. Flash MX 2004