Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-23-2007, 06:52 PM   #1
rgpassey
Ryan
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 35
Question disable Enter!

Hey Guys,
I am building a tutorial on a gui application. At certain spots the trainee needs to input data then hit 'enter'. I allow it with:

hitkey=0;
onEnterFrame = function(){
hitkey=Key.isDown(13);
if(hitkey){
perform list of actions, such as goto next screen, etc.
}
}

the ascii for 'enter' is 13, so essentially, if you hit enter it goes to the next screen.

This all works. But the problem is, that it doesn't stop working. In the list of actions (above) I've tried disabling the movieclip the actionscript contains, I've tried setting _visibility to 0. I can't get it to stop, so when the trainee hits 'enter' any time after that, further into the simulation, the same function activates in the wrong part of the lesson, messing the whole thing up. How can I disable the enter key, or at least the script that waits for it?

Thanks in advance.
rgpassey is offline   Reply With Quote
Old 07-23-2007, 06:57 PM   #2
sunlis
Mac user and proud
 
sunlis's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 694
Send a message via MSN to sunlis Send a message via Skype™ to sunlis
Default

ActionScript Code:
hitkey=0; enterHit = false; onEnterFrame = function(){ hitkey=Key.isDown(13);   if(enterHit !== true){     if(hitkey){       //perform list of actions, such as goto next screen, etc.       enterHit = true;     }   } }
__________________
//dA
//blog
//site
sunlis is offline   Reply With Quote
Old 07-23-2007, 07:06 PM   #3
xxneon
Super Moderator
 
xxneon's Avatar
 
Join Date: Dec 2006
Location: Amish Country, PA
Posts: 8,570
Send a message via ICQ to xxneon Send a message via AIM to xxneon Send a message via MSN to xxneon Send a message via Skype™ to xxneon
Default

ActionScript Code:
hitkey=0; onEnterFrame = function(){     hitkey=Key.isDown(13);     if(hitkey){         //perform list of actions, such as goto next screen, etc.         delete onEnterFrame;     } }
xxneon is offline   Reply With Quote
Old 07-23-2007, 07:12 PM   #4
rgpassey
Ryan
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 35
Default thanks!

DANG! you guys are fast!
I did what you suggested, and it works like a charm. I knew there was a reason I needed to join this forum. Thanks a ton!

(man, I'm stoked!)
rgpassey 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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I disable the Enter Key press in a Text field? sriku ActionScript 2.0 6 06-13-2007 05:41 AM
disable enter key or freeze level salami ActionScript 1.0 (and below) 2 06-30-2005 10:06 AM
Disable Enter button so it's set for my functions Citizenkane ActionScript 2.0 0 03-10-2005 07:58 AM
Disable ENTER key in textfields deQue Components 0 08-16-2004 03:21 PM
keyPress, the Enter key, and Disable Keyboard Shortcuts Art ActionScript 1.0 (and below) 1 08-04-2001 01:41 AM


All times are GMT. The time now is 01:39 AM.

///
Follow actionscriptorg on Twitter

 


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