Solved

Move an object on keypress

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Link puzzle piece images together and change color on hover 2 444
Adobe Flash Free Transform Tool 2 143
System Center Configuration Manager 2012R2 7 90
File conversion question 5 118
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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…
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…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

839 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