Solved

Move an object on keypress

Posted on 2006-07-06
5
325 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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…
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 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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now