|
From: | Pablo Rodríguez |
Subject: | [Swftools-common] issue with key listener |
Date: | Sat, 06 Nov 2010 21:13:18 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc13 Thunderbird/3.1.6 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |