Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
Knight Miniatures webforumsuser@macromedia.com #1
Keyboard / Mouse quirk....
I've defined a Key object and within its onPress action I set a variable userKeyUp to false. In the Key's onRelease action I set userKeyUp back to true. Similarly, I have a button object and in its onPress action I also set the variable userKeyUp to false, and in its onRelease action the variable is set to true. The idea is to prevent cross-talk between the keyboard and mouse in the interface (i.e. multiple things happening at once, multiple subsequent keypresses higher than framerate, etc). However, for some reason it isn't working as expected. (The button and key words below are replaced with actual object names in my code.)
userKeyUp = true;
button.onPress = function() {
userKeyUp = false;
nextFrame();
} // flag key down and advance to next frame
button.onRelease = function() {
userKeyUp = true;
} // flag key up when button is released
key.onKeyDown = function() {
if(userKeyUp) {
button.gotoAndStop("_down");
userKeyUp = false;
nextFrame();
} // perform actions only if key flag is true
}
key.onKeyUp = function() {
userKeyUp = true;
} // flag key up
(The code above is stripped down and simplified so you can see the basic logic clearly.) With this code, supposedly, if I click and hold the mouse down on the button object, I should not be able to execute any keyboard actions in the keyonKeyDown function until the mouse has been released. However, what's really happening is the keyboard is working normally while the mouse is held down. Any ideas why this isn't working?
Knight Miniatures webforumsuser@macromedia.com Guest
-
Varible clearance, mouse/keyboard
I seem to be having problems with my login scripts. I have mentioned this here before, but have some more ideas i would like to run past you all.... -
Mouse click or keyboard...
Hi people... this is an easy one... i want to add a script to my movie... that makes it go to the next frame when the users clicks the mouse... -
USB Keyboard & Mouse Compatability
Hi, I have a USB wireless keyboard and mouse combo. When I start the set up programme for Mandrake 9.1 they are recognised until after I press... -
Trying to setup a wireless keyboard + mouse
Hi everybody, I'm trying to setup a Debian (unstable) system running on a 2.4.21 kernel with a mouse + keyboard wireless (RF) combo. The model... -
Keyboard & Mouse Not Responding
Thanks I will pass on the suggestion to my mom. I'm not sure what OS version she is using. It would be whatever version shipped with it 2 years... -
Knight Miniatures webforumsuser@macromedia.com #2
Re:Keyboard / Mouse quirk....
By the way, I've also tried this using two flags, one for the keyboard and one for the mouse, so that keyboard key releases won't reset the userKeyUp flag while the mouse is still down. In the onKeyDown function, I then used if(userKeyUp && mButtonUp) but the same results are happening. Keyboard keys are still performing the nextFrame action while the mouse is down, despite the variables being true (confirmed with a trace action).
Knight Miniatures webforumsuser@macromedia.com Guest
-
Knight Miniatures webforumsuser@macromedia.com #3
Re:Keyboard / Mouse quirk....
More info:
This IS working fine when the movie plays as a _root. However, if the movie is placed inside another movie, as I am doing, then it suddenly stops working. Still have no clue why....
Knight Miniatures webforumsuser@macromedia.com Guest
-
Knight Miniatures webforumsuser@macromedia.com #4
Re:Keyboard / Mouse quirk....
Okay, this is scary....After exiting out of Flash and restarting it, the mouse and keyboard actions are behaving correctly, even inside nested movie clips. So now that it's working, the question becomes how reliable is this?
Knight Miniatures webforumsuser@macromedia.com Guest



Reply With Quote

