Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hitting the enter key

Posted on 2002-04-01
3
Medium Priority
?
218 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 800 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

824 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