| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Nov 2006
Posts: 8
|
Hey Guys,
I'm kind of new to this forum, and I was wondering if someone could help me out. I'm an industrial designer trying to learn how to use flash as sort of an operating system. Currently I'm trying to emulate a touch strip within flash using the keyboard. I'm using four buttons: 'g' 'h' 'j' 'k'. Now I want to detect if a user is sliding along the buttons in one direction or the other, and I also want to detect if a user is pressing one button for a longer period of time. I actually have a working flash movie that does just this, but my code is a mess. I've attached a zip file with the .fla file in it, anyone care to give me some pointers? Kind regards, Guus |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Jan 2005
Posts: 475
|
There are quite a few problems with keyUp events in flash. For example if you press down more than one key only the last one down generates an up event. Also, if the window loses focus while the keys are down, no keyUp event is fired.
You'd be better off using an onEnterFrame event handler to detect which keys are actually down... ActionScript Code:
|
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Nov 2006
Posts: 8
|
I'm actually using a windows mobile device with FlashLite 2.1, so that's why I wasn't using an onEnterFrame.
I think my device will act slower if I use this, or am I wrong? |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Jan 2005
Posts: 475
|
Polling is never ideal, but as key up is next to useless its the next best option. That said, I've never used Flash Lite so maybe Lite's key events are more robust? I sort of doubt it, but you can easily test it...
|
|
|
|
|
|
#5 |
|
Registered User
Join Date: Nov 2006
Posts: 8
|
I've just had access to the testing platform, and this script is actually performing the way it should. So the only thing left is to optimize it for performance.
Do you see any other big mistakes except for my keyUp & keyDown events? Thanks |
|
|
|
|
|
#6 |
|
Registered User
Join Date: Jan 2005
Posts: 475
|
looks fine to me
|
|
|
|
|
|
#7 |
|
Registered User
Join Date: Nov 2006
Posts: 8
|
Ok, then I'll continue on from this.
Thanks a lot for the help! |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to strip unessery tags from html textfield before posting? | Paul Ferrie | Other Flash General Questions | 4 | 09-07-2008 03:39 PM |
| strip all HTML tags | Reflex | ActionScript 1.0 (and below) | 1 | 05-02-2007 01:53 AM |
| Touch screen with flash problem | tsong_1037 | ActionScript 1.0 (and below) | 5 | 01-19-2005 02:59 PM |
| touch screen with flash | pound | Other Flash General Questions | 2 | 11-09-2004 02:58 PM |
| How can I detect when 2 swf's loaded into a movie touch? | BuckD | ActionScript 1.0 (and below) | 3 | 12-17-2003 02:44 PM |