| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
|
I've started learning to build games in Flash and have a question regarding onClipEvent (enterFrame)
I have a test character whose animation is controlled by arrow-key presses and currently his mc code goes like this.. onClipEvent (enterFrame){ if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) { gotoAndPlay ("leap"); } } It all works fine, as you can see here, but you'll notice that he only jumps when you release your finger from the UP key. I'd like him to jump immediately the key is pressed, and I'm sure the problem is this: as long as your finger is on the UP key, that line of code is continuously being run, i.e. gotoAndPlay ("leap"); Therefore, he's stuck on the frame labelled 'leap'. When you release your finger however, he jumps away. Could anyone please tell me how I'd run that piece of code only once? I have tried using a counter variable, but I'm not too good at ActionScript (trying to remedy that) and I'm sure I'm doing everything wrong. Cheers |
|
|
|
|
|
#2 |
|
What the hell is a sumul?
Join Date: Apr 2002
Location: USA
Posts: 222
|
You could try something like ...
ActionScript Code:
|
|
|
|
|
|
|
|
|
#3 |
|
Registered User
|
thanks for your help
![]() your advice was great and I've got it working now.. the bit I don't understand about your reply was the Flash MX onKeyDown event.. Yes I am using Flash MX, but could you tell me something about onKeyDown please? I had no idea it existed. |
|
|
|
|
|
#4 | |
|
Addicted To FLASH
|
Quote:
__________________
â€* GOD Is Near â€* Questions Don't PM for Questions An eye for an eye, make the whole world blind _____________________________________________GHANDI |
|
|
|
|
|
|
#5 |
|
Registered User
|
cheers farafiro
reading now |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Flash Player not in end users computer | Andy S | Other Flash General Questions | 4 | 05-17-2004 09:10 AM |
| scrollBar on Flash Exchange | cdeg | Components | 5 | 05-03-2004 08:13 PM |
| Position Available: Flash Game Programmer | loveboat | Projects and Positions | 0 | 08-25-2003 08:49 PM |
| Hill Billy Whack? Flash Game Help Needed | agentfive | Projects and Positions | 0 | 04-16-2002 12:19 AM |
| Flash Player in IE on Mac Problem | GDubb | ActionScript 1.0 (and below) | 0 | 04-04-2002 05:48 PM |