Solved

Hitting the enter key

Posted on 2002-04-01
3
181 Views
Last Modified: 2010-04-03
Here is a tricky one for you.

In a movie clip I need to have the user hit the 'Enter' key to move to frame 20.

a regular keyPress does not work within a movie clip, only on the main timeline as far as I can see and test.

on (keyPress "<Enter>") {
gotoAndPlay(20);
}


Any code ideas?

Thanks...........Rob

0
Comment
Question by:jsttriit
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
mousefist earned 200 total points
ID: 6911022

hmm, well this *should* work as far as i can see.  if you are certain that you don't have another button anywhere else that's catching the enter key, then there are still a bunch of other ways to do this ... or try!

first, you could try to catch the keyDown with the movieclip itself: get the actions for the instance of the movie clip on the stage and put in:

onClipEvent(keyDown) {
  if (Key.getCode() == Key.ENTER) {
    this.gotoAndPlay(20);
  }
}

you may hafta fudge that a bit ... the scope is a little weird for those ... it might be this.movieclip.gotoAndPlay(20) ... sorry i don't quite remember!  ;-)

if that doesn't do anything, there's at least one other way i can think of.  if you are using mx, or if you at least are using the newest player, you could add an event listener.  if the first way doesn't do you any good, then lemme know and i'll walk you through using the listener.

m!
0
 

Author Comment

by:jsttriit
ID: 6911043
You got the points for thinking of it the same way I did.  As soon as I wrote similiar code, I saw your post.

Bascially I put another clip in my clip and made it do the checking.  Then when it saw an Enter keystroke I just made it talk to the parent.

Thanks....Rob
0
 
LVL 2

Expert Comment

by:mousefist
ID: 6911112
nice one!  thanks!

m!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to record live broadcast.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now