SunQuest
           Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 3rd, 2003, 05:25 PM
kubicon's Avatar
kubicon kubicon is offline
pogremar
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Location: At Work
Posts: 945 kubicon User rank is Corporal (100 - 500 Reputation Level)kubicon User rank is Corporal (100 - 500 Reputation Level)kubicon User rank is Corporal (100 - 500 Reputation Level)kubicon User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 14 h 50 m 47 sec
Reputation Power: 7
responding to keys

I'm using the following function to move sprites. The if with key.isDown(key.LEFT)) works properly. The other IFs have variables that represent the numberical ascii values of the keys. For instance _root.rbutton is the number 97 which is the letter a. However, those ifs are not working. How do I detect for keys that do not have constants associated with them such as the letter a b d m x y z?

function moveMouse() {
if (Key.isDown(key.LEFT)) {
this._x -= 5;
}
if (Key.isDown(_root.rbutton)) {
this._x += 5;
}
if (Key.isDown(_root.ubutton)) {
this._y -= 5;
}
if (Key.isDown(_root.dbutton)) {
this._y += 5;
}

trace("calling moveMouse");
}
__________________
Some day I'll create a smart quote to put here.

Reply With Quote
  #2  
Old August 4th, 2003, 08:01 AM
jamieB jamieB is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2002
Posts: 592 jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 56 m 16 sec
Reputation Power: 17
this worked OK for me
Code:
ubutton = 65;//a
dbutton = 66;//b
rbutton = 67;//c
function moveMouse() { 
	if (Key.isDown(_root.rbutton)) { 
		this._x += 5; 
	} else if (Key.isDown(_root.ubutton)) { 
		this._y -= 5; 
	} else if (Key.isDown(_root.dbutton)) { 
		this._y += 5; 
	} 
	
	trace("calling moveMouse"); 
}
my_mc.onMouseMove = moveMouse;

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > responding to keys


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway