Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > FlashLite / Portable Devices Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-23-2006, 05:06 AM   #1
GuusT
Registered User
 
Join Date: Nov 2006
Posts: 8
Default Touch Strip

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
Attached Files
File Type: zip LongpressV2.zip (6.6 KB, 108 views)
GuusT is offline   Reply With Quote
Old 11-23-2006, 05:30 AM   #2
blockage
Registered User
 
Join Date: Jan 2005
Posts: 475
Default

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:
function onEnterFrame () :Void {         if ( Key.isDown( 71 ) ) {              // g is down         }         if ( Key.isDown( 72 ) ) {              // h is down         }         if ( Key.isDown( 74 ) ) {              // j is down         }         if ( Key.isDown( 75 ) ) {              // k is down         } }
blockage is offline   Reply With Quote
Old 11-23-2006, 05:54 AM   #3
GuusT
Registered User
 
Join Date: Nov 2006
Posts: 8
Default

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?
GuusT is offline   Reply With Quote
Old 11-23-2006, 06:03 AM   #4
blockage
Registered User
 
Join Date: Jan 2005
Posts: 475
Default

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...
blockage is offline   Reply With Quote
Old 11-23-2006, 06:09 AM   #5
GuusT
Registered User
 
Join Date: Nov 2006
Posts: 8
Default

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
GuusT is offline   Reply With Quote
Old 11-23-2006, 06:19 AM   #6
blockage
Registered User
 
Join Date: Jan 2005
Posts: 475
Default

looks fine to me
blockage is offline   Reply With Quote
Old 11-23-2006, 06:20 AM   #7
GuusT
Registered User
 
Join Date: Nov 2006
Posts: 8
Default

Ok, then I'll continue on from this.

Thanks a lot for the help!
GuusT is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 09:45 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.