1 Reply Latest reply on Jun 9, 2009 6:56 AM by C-Rock

    repeating functions while key pressed?

    shintashi Level 1

      I'm just starting to learn to make my own functions and was trying to make a walk sequence. My original program used an elaborate series of counters and onEnterframe, but I want to take a different route (basically starting from scratch) because my walk sequences always turned the avatars into picasso paintings when two or more keys were pressed simultaneously.


      I'm more familiar now with set and clear timeout, but what do I do if I want a specific sequence to count up, then down, or rotate back and forth, like the pendulum of a clock?


      starting with a basic function like


      function walk(bodypart){
      bodypart._rotation += 45;


      ...if (keyUsed == 68){

      what do I have to change so the square rotates back and forth +/- 45 degrees while depressed?