Hi there,

I have added the same function to an AS2 code (below) that works with a mouse listener, but not with the keyboard listener.

I have written listeners before, but I must be missing something here. Could anyone be so kind to tell me what I'm doing wrong?

Thanks,


Pablo



 function control_movie(){
         if (play_mode == 1) {
                movie.stop();
                play_mode = 0;
         } else if (play_mode == 0){
                movie.play();
                play_mode = 1;
         }
 }

 function double_click(){
         if ((getTimer() - lastClick) < 400) {
                control_movie();
         } else {
                lastClick = getTimer();
         }
 }

 Mouse.onMouseDown = function() {
         double_click();
 };

 Mouse.addListener(Mouse);

 key_listen = new Object;

 key_listen.onKeyDown = function() {
         if (Key.isDown(112)) {
                 control_movie();
         }
 };

 Key.addlisterner(key_listen);
--
http://www.ousia.tk

Reply via email to