Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hitting the enter key

Posted on 2002-04-01
3
Medium Priority
?
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
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 …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

688 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