Problem with keyCodes. AS3

Hello I am new here :slight_smile:
Actually I just registered because I need help with this problem, I have this code:


stage.addEventListener(KeyboardEvent.KEY_DOWN, entering, false, 0, true);
function entering(Event:KeyboardEvent):void {
    if (Event.keyCode==37) //left{
        moveleft=true;
    }
    if (Event.keyCode==39) //right{
        moveright=true;
    }
    if (Event.keyCode==38)//up{
        moveup=true;
    
    
    if (Event.keyCode==40) //down{
        movedown=true;
    }
    if (Event.keyCode==65) //pink a {
        pinking=true;
    }
    if (Event.keyCode==83) //blue s{
        blueing=true;
    }
    if (Event.keyCode==68)  // green d{
        greening=true;
    }

}

stage.addEventListener(Event.ENTER_FRAME, framing, false, 0, true);
function framing(event:Event):void {
    Background.transform.colorTransform=colorbackground;
    if (colorbackground.redOffset<225) {
        colorbackground.redOffset+=10;
    }
    if (colorbackground.blueOffset<225) {
        colorbackground.blueOffset+=10;
    }
    if (colorbackground.greenOffset<225) {
        colorbackground.greenOffset+=10;
    }
    if (colorbackground.redOffset>225) {
        colorbackground.redOffset-=10;
    }
    if (colorbackground.blueOffset>225) {
        colorbackground.blueOffset-=10;
    }
    if (colorbackground.greenOffset>225) {
        colorbackground.greenOffset-=10;
    }
    if (pink==1) {
        colorbackground.redOffset=255;
        colorbackground.blueOffset=140;
        colorbackground.greenOffset=25;
    }
    if (blue==1) {
        colorbackground.redOffset=40;
        colorbackground.blueOffset=250;
        colorbackground.greenOffset=65;
    }
    if (green==1) {
        colorbackground.redOffset=47;
        colorbackground.blueOffset=85;
        colorbackground.greenOffset=242;
    }
    if (pinking) {
        pink+=1;
    }
    if (blueing) {
        blue+=1;
    }
    if (greening) {
        green+=1;
    }
    if (!pinking) {
        pink=0;
    }
    if (!blueing) {
        blue=0;
    }
    if (!greening) {
        green=0;
    }
    if (moveleft) {
        Cordx.x-=4;
    }
    if (moveright) {
        Cordx.x+=4;
    }
    if (moveup) {
        Cordy.y-=4;
    }
    if (movedown) {
        Cordy.y+=4;
    }
}
stage.addEventListener(KeyboardEvent.KEY_UP, exiting, false, 0, true);
function exiting(Event:KeyboardEvent):void {
    if (Event.keyCode==37) {
        moveleft=false;
    }
    if (Event.keyCode==38) {
        moveup=false;
    }
    if (Event.keyCode==39) {
        moveright=false;
    }
    if (Event.keyCode==40) {
        movedown=false;
    }
    if (Event.keyCode==65) {
        pinking=false;
    }
    if (Event.keyCode==83) {
        blueing=false;
    }
    if (Event.keyCode==68) {
        greening=false;

    }
}

The problem is that when I am moving left and up, “pink”-a “blue”-s and “green”-d work.
When I am moving down and right, none work.
When I am moving right and up, only “pink”-s and “blue”-d work.
I have tried changing the order of my code but it does not work, What am I missing?