Forum Topic: Noob Question!

(162 views • 11 replies)

This topic is 1 page long.

<< < > >>
None

Spikedit

Reply To Post Reply & Quote

Posted at: 4/10/09 07:55 AM

Spikedit NEUTRAL LEVEL 01

Sign-Up: 03/02/09

Posts: 41

Sorry about the double post. (I accidentally put it in the politics forum)

How do I make it so that on frame 5 of a flash, if the key "A" is pressed, the frame goes to 6?


None

Denvish

Reply To Post Reply & Quote

Posted at: 4/10/09 08:03 AM

Denvish DARK LEVEL 45

Sign-Up: 04/25/03

Posts: 16,238

Put this code on frame 5:

kl=new Object();
kl.onKeyDown=function(){
	if(Key.getCode()==65){
		gotoAndStop(6);
		Key.removeListener(kl);
	}
}
Key.addListener(kl);

stop();

- - Flash - Music - Images - -

BBS Signature

None

4urentertainment

Reply To Post Reply & Quote

Posted at: 4/10/09 08:13 AM

4urentertainment NEUTRAL LEVEL 13

Sign-Up: 08/01/08

Posts: 1,542

Or, if you're using AS2

stop();
this.onEnterFrame = function(){
if(Key.isDown(65)){_root.play();}
}

"When you look at yourself from a universal standpoint, something inside always reminds or informs you that there are bigger and better things to worry about. "- Einstein


None

Shinki

Reply To Post Reply & Quote

Posted at: 4/10/09 08:28 AM

Shinki DARK LEVEL 10

Sign-Up: 02/14/05

Posts: 1,571

At 4/10/09 08:13 AM, 4urentertainment wrote: Or, if you're using AS2

Denvish posted AS2. :p

If a picture is worth a thousand words, a game is worth a play.

BBS Signature

None

Spikedit

Reply To Post Reply & Quote

Posted at: 4/10/09 08:34 AM

Spikedit NEUTRAL LEVEL 01

Sign-Up: 03/02/09

Posts: 41

Thanks guys, what are the key numbes for "p" and "ctrl"? (like A is 65)


None

Denvish

Reply To Post Reply & Quote

Posted at: 4/10/09 09:45 AM

Denvish DARK LEVEL 45

Sign-Up: 04/25/03

Posts: 16,238

At 4/10/09 08:34 AM, Spikedit wrote: Thanks guys, what are the key numbes for "p" and "ctrl"? (like A is 65)

http://denvish.net/images/keycode/

- - Flash - Music - Images - -

BBS Signature

None

4urentertainment

Reply To Post Reply & Quote

Posted at: 4/10/09 09:52 AM

4urentertainment NEUTRAL LEVEL 13

Sign-Up: 08/01/08

Posts: 1,542

At 4/10/09 08:28 AM, Shinki wrote:
At 4/10/09 08:13 AM, 4urentertainment wrote: Or, if you're using AS2
Denvish posted AS2. :p

I may not know AS3, but I know that that was AS3.

right?

"When you look at yourself from a universal standpoint, something inside always reminds or informs you that there are bigger and better things to worry about. "- Einstein


None

Kirk-Cocaine

Reply To Post Reply & Quote

Posted at: 4/10/09 10:03 AM

Kirk-Cocaine EVIL LEVEL 36

Sign-Up: 08/17/03

Posts: 17,815

At 4/10/09 09:52 AM, 4urentertainment wrote: I may not know AS3, but I know that that was AS3.

No it was AS2. This is AS3:

function keys(e:KeyboardEvent):void{
if(e.keyCode == 65){
//A is down
}
}

addEventListener(KeyboardEvent.KEY_DOWN, keys);

Big difference.

YOUR COFFIN OR MINE?

BBS Signature

None

Spikedit

Reply To Post Reply & Quote

Posted at: 4/10/09 10:40 AM

Spikedit NEUTRAL LEVEL 01

Sign-Up: 03/02/09

Posts: 41

I'm using AS2. And there is a problem. When, after I have pressed A, later on in the flash you have to type something. The thing you have to type has an a, but when you try to type it, it brings you way back to frame 6. How do I make that stop?


None

andy70707

Reply To Post Reply & Quote

Posted at: 4/10/09 10:45 AM

andy70707 LIGHT LEVEL 22

Sign-Up: 09/30/07

Posts: 2,349

probably cause you put put the code on a frame in a new layer, and there are no other keyframes since. If this is the case, put a blank keyframe after the frame with the code in.

add me on xbox 360: CoD4 and CoD5 (and sometimes TF2) gamertag: andy70707

BBS Signature

None

Spikedit

Reply To Post Reply & Quote

Posted at: 4/10/09 10:47 AM

Spikedit NEUTRAL LEVEL 01

Sign-Up: 03/02/09

Posts: 41

Thanks it works now


None

Denvish

Reply To Post Reply & Quote

Posted at: 4/10/09 11:02 AM

Denvish DARK LEVEL 45

Sign-Up: 04/25/03

Posts: 16,238

At 4/10/09 10:03 AM, Kirk-Cocaine wrote:
At 4/10/09 09:52 AM, 4urentertainment wrote: I may not know AS3, but I know that that was AS3.
No it was AS2.

Aye, AS2 does have some listener capabilities, just not as extensive or necessary as AS3. Most people seem to prefer to use an enterFrame Key.isDown check, but the Key.Listener is definitely a better method in some (most?) cases.

- - Flash - Music - Images - -

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 05:35 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!