Be a Supporter!

A little help?

  • 322 Views
  • 3 Replies
New Topic Respond to this Topic
Ahnimal
Ahnimal
  • Member since: Feb. 12, 2009
  • Offline.
Forum Stats
Member
Level 19
Game Developer
A little help? 2009-03-30 14:02:39 Reply

How do I make my flash so something happens when I press a key on my keyboard?
I have tried looking through the tutorial, but I can't get it to work.


It's not a bug, it's a feature!

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to A little help? 2009-03-30 18:26:17 Reply

Code on main timeline:

kl=new Object();
kl.onKeyDown=function(){
	if(Key.getCode()==32){
		//DO STUFF
	}
}
Key.addListener(kl);

Find code for keys


- - Flash - Music - Images - -

BBS Signature
Ahnimal
Ahnimal
  • Member since: Feb. 12, 2009
  • Offline.
Forum Stats
Member
Level 19
Game Developer
Response to A little help? 2009-03-31 16:40:51 Reply

At 3/30/09 06:26 PM, Denvish wrote: Code on main timeline:

kl=new Object();
kl.onKeyDown=function(){
if(Key.getCode()==32){
//DO STUFF
}
}
Key.addListener(kl);

Find code for keys

Is that AS2 or AS3?


It's not a bug, it's a feature!

4urentertainment
4urentertainment
  • Member since: Aug. 1, 2008
  • Offline.
Forum Stats
Moderator
Level 13
Game Developer
Response to A little help? 2009-03-31 16:43:19 Reply

That's AS3