The last line of your code reads like one of my many typos Pablo.

  Key.addlisterner(key_listen);  ???

That could be why it doesn't work! ;o)

( The swfc compiler quite often doesn't flag AS2 script errors ).

Regards,


Chris.
 
On Sat, 06 Nov 2010 21:13:18 +0100
Pablo Rodríguez <[email protected]> wrote:

> 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
> 
> 


-- 
Chris <[email protected]>

Reply via email to