Solved

Move an object on keypress

Posted on 2006-07-06
5
326 Views
Last Modified: 2008-03-17
How do I move a graphic on keypress

on (keyPress "<Enter>") {

Move graphic left here

}



Thanks,
iamatramp
0
Comment
Question by:iamatramp
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
ddlam earned 50 total points
ID: 17056572
1 Create a new movie clip(Ctrl+F9)
2 import or paste your graphic into the movie clip
3 drag your movie clip to stage and name your movie clip instance name as "picture" (Ctrl+F3)
4 add below into main timeline, frame 1

this.onEnterFrame = function(){
  if(Key.isDown(Key.ENTER)) {
    picture._x++;
  }
}
0
 

Expert Comment

by:Gorba916
ID: 17239474
listenerObj = new Object();
listenerObj.onKeyDown = function()
{
      if (Key.getCode() == 13) {
            trace("You pressed Enter!");
            picture._x++;
      }
}
Key.addListener(listenerObj);
0
 

Expert Comment

by:Gorba916
ID: 17239479
To make Enter and Backspace work make sure "disable keyboard shortcuts" is checked in the test move playback... Controls > disable keyboard shortcuts
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

Suggested Solutions

Title # Comments Views Activity
How to put actionscript code for a button? 6 118
Can't get text from a text entry 13 278
Flash player plugin 13 7 324
File drag and drop 6 132
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

863 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

27 Experts available now in Live!

Get 1:1 Help Now