Solved

Hitting the enter key

Posted on 2002-04-01
3
170 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
Comment Utility

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
Comment Utility
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
Comment Utility
nice one!  thanks!

m!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

772 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

10 Experts available now in Live!

Get 1:1 Help Now