0

Hey all.
I'm doing a new project in AS3 to try and learn more (I've only every used AS2), and I'm having some problems...
Whenever I run the program as it is, it tells me (Output Window) that my Keyboard events don't do anything? I have almost 101 lines of code, and probably 90% of it are under the KeyboardEvent scripts...
Anyways, here's what I have so far.

stop();

import flash.events.KeyboardEvent;

var left:uint = 37;
var up:uint = 38;
var right:uint = 39;
var down:uint = 40;
var Choice:Number = 0;
var SYS:Number = 0;

stage.addEventListener(KeyboardEvent.KEY_DOWN,CONTROLz);

function CONTROLz(e:KeyboardEvent) {
    if (e.keyCode == Keyboard.ENTER) {
        if (SYS == 0) {
            PausePage.play();
        } else {
//          if(Choice = 1){
//          PicMC.gotoAndPlay("");
//          }
//          if(Choice = 2){
//          PicMC.gotoAndPlay("");
//          }
        }
    }
    if (e.keyCode == Keyboard.DOWN) {
        Choice = Choice + 1;
        if (Choice == 11) {
            Choice = 10;
        }
        if (Choice == 0) {
            CharList.SHINE.y = -213.7;
        }
        if (Choice == 1) {
            CharList.SHINE.y = -176.7;
        }
        if (Choice == 2) {
            CharList.SHINE.y = -141.6;
        }
        if (Choice == 3) {
            CharList.SHINE.y = -100.7;
        }
        if (Choice == 4) {
            CharList.SHINE.y = -64.7;
        }
        if (Choice == 5) {
            CharList.SHINE.y = -27.6;
        }
        if (Choice == 6) {
            CharList.SHINE.y = 13.3;
        }
        if (Choice == 7) {
            CharList.SHINE.y = 47.3;
        }
        if (Choice == 8) {
            CharList.SHINE.y = 83.3;
        }
        if (Choice == 9) {
            CharList.SHINE.y = 122.3;
        }
        if (Choice == 10) {
            CharList.SHINE.y = 158.3;
        }
    }
    if (e.keyCode==up) {
        Choice = Choice - 1;
        if (Choice == -1) {
            Choice = 0;
        }
        if (Choice == 0) {
            CharList.SHINE.y = -213.7;
        }
        if (Choice == 1) {
            CharList.SHINE.y = -176.7;
        }
        if (Choice == 2) {
            CharList.SHINE.y = -141.6;
        }
        if (Choice == 3) {
            CharList.SHINE.y = -100.7;
        }
        if (Choice == 4) {
            CharList.SHINE.y = -64.7;
        }
        if (Choice == 5) {
            CharList.SHINE.y = -27.6;
        }
        if (Choice == 6) {
            CharList.SHINE.y = 13.3;
        }
        if (Choice == 7) {
            CharList.SHINE.y = 47.3;
        }
        if (Choice == 8) {
            CharList.SHINE.y = 83.3;
        }
        if (Choice == 9) {
            CharList.SHINE.y = 122.3;
        }
        if (Choice == 10) {
            CharList.SHINE.y = 158.3;
        }
    }
}

I know that I'm using two different keyCode systems at the moment, but neither solve the problem.
The ONLY issue is that somewhere in my variables code I have derped up, because everything else works perfectly. Even the Enter key for now...

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by RedexProGamma
0

Nevermind... Truns out that I had names SHINE through the Library's Linkage option instead of setting an instance Name, so the code couldn't find SHINE in Charlist, just SHINE in the library.... >~>

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.