USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 4/10/09 07:55 AM
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?
Posted at: 4/10/09 08:03 AM
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 - -
Posted at: 4/10/09 08:13 AM
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
Posted at: 4/10/09 08:28 AM
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.
Posted at: 4/10/09 08:34 AM
Thanks guys, what are the key numbes for "p" and "ctrl"? (like A is 65)
Posted at: 4/10/09 09:45 AM
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/
Posted at: 4/10/09 09:52 AM
At 4/10/09 08:28 AM, Shinki wrote: At 4/10/09 08:13 AM, 4urentertainment wrote: Or, if you're using AS2Denvish posted AS2. :p
I may not know AS3, but I know that that was AS3.
right?
Posted at: 4/10/09 10:03 AM
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?
Posted at: 4/10/09 10:40 AM
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?
Posted at: 4/10/09 10:45 AM
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
Posted at: 4/10/09 10:47 AM
Thanks it works now
Posted at: 4/10/09 11:02 AM
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.
All times are Eastern Standard Time (GMT -5) | Current Time: 05:35 AM
<< Back