Skip to main content
SuperGibaLogan
Known Participant
August 15, 2023
Question

how do i make a movieclip move forever when the arrow keys are pressed in actionscript 2.0?

  • August 15, 2023
  • 1 reply
  • 559 views

can someone give me the code that makes a movieclip move forever when the arrow keys are pressed? im working on a pac-man flash recreation, im using flash 8, also i want the movieclip to move like how pac-man moves in the original game

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    August 16, 2023

    var keyListener:Object = new Object();
    keyListener.onKeyDown = function() {
    if(Key.getCode()==37){
    //left
    } else if(Key.getCode()==39){
    //right
    } else if(Key.getCode()==38){
    //up
    } else if(Key.getCode()==40){
    //down
    }
    };
    Key.addListener(keyListener);

    SuperGibaLogan
    Known Participant
    August 16, 2023

    i putted the code on the frame actions, but the movieclip isnt moving

    SGL
    kglad
    Community Expert
    Community Expert
    August 17, 2023

    show your code.