  | |  | key press | key press
2004-02-19 - By Adrian McTaggart
Back I have the following code that moves an mc 'rulesMC ' onto the stage whenever either the button mc 'rules_btn ' is pressed or the 'r ' key is pressed.
-- ---- ---- ---- ---- ---- ---- -----
rules_btn.onRelease = rulesFunction;
var keyR = new Object();
keyR.onKeyDown = function(){
if(Key.getCode() == 82){
rulesFunction();
}
}
Key.addListener(keyR);
function rulesFunction(){
_root.rulesMC._x = 0;
}
-- ---- ---- ---- ---- ---- ---- -----
I want to adapt this so that if the user clicks 'r ' a second time the mc 'rulesMC ' moves back off the stage to a position of x = -615. I got this working using a conditional statement that checked the x position of 'rulesMC ' and moved it accordingly. This worked but the user needed to press the 'r ' key a few times to start with.
Can anyone suggest a way that may be a better approach?
TIA,
Adrian
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104737
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |