Mailing List
Home
Flash Pro
Extending Flash
Flash Macromedia Developer
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
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)