swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swftools-common] issue with key listener


From: Chris
Subject: Re: [Swftools-common] issue with key listener
Date: Sat, 6 Nov 2010 22:42:33 +0100

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 <address@hidden> 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 <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]