ActionScript 3.0 :: Movie Clip Will Not Loop When Arrow Keys Are Held Down
Oct 13, 2008
I have a movie clip of a character who is supposed to walk when the arrow keys are held down. The character does move in response to the keys being held down, but the walk cycle in the movie clip only plays once. (Flash file is attached.)
I used a Trace in the code to see what the issue is, and one thing that I noticed is that the function seems to run over and over. I'm wondering if that has something to do with it?
View 4 Replies
Similar Posts:
Apr 16, 2011
I created an animated character as a movie clip and I want to be able to move it using the arrow keys. I created a new layer and have the character on that layer.
View 9 Replies
Nov 3, 2009
I'm trying to move a movie clip using the arrow keys. It's a very simple test animation. Basically I have a stick character with simple walking animation. It has 3 movement. 1 is a forward walk, 2 is a duck and 3 is a backwards walk. Now I can move the character but I cant keep the animation going. Is there something I'm missing??
[Code]...
View 4 Replies
Apr 18, 2009
I have a MC called Robot. It is animated with keyframes so that my robot appears to walk. There is an Action on frame 8 that says, "gotoAndPlay(1)".When the user pushes the arrow keys, I want to MC to move in the direction of the press arrow. I also want the MC to start playing at keyframe 9 so it plays the walking animation.
This all works but with one small problem. If the arrow key is held down, the "gotoAndPlay(9)" stops the animation from playing, instead showing only the graphic that is on the 9nth keyframe.
Code:
// initialize arrow variables
var leftArrow:Boolean = false;
var rightArrow:Boolean = false;[code]....
Is there a way to call a function once and play the MC frames until the arrow key is not pressed? I think the problem I am having is that if the key is held down, the EventListener keeps running and starting the MC in the same frame instead of allowing the MC to play as I want it to.
View 5 Replies
Jul 25, 2009
I have just recently returned to flash after a very looooooooong time! I moved out of the flash world a few years ago and have been working in design for print. A friend has asked me to help create a flash slideshow for them. I know how to do this using older versions of flash but there seems to be a quicker way in CS3.I have selected from the opening menu, Flash Slide Presentation.I have created my slideshow and added transitions.Everything looks great however I can only progress the slideshow using the arrow keys.My question is...Using this slideshow setting can I set my slideshow to loop through the slides automatically instead of progress with the arrow keys?
View 2 Replies
Mar 14, 2002
I'm trying to control (via the arrow keys) a simple box "movie" on the main stage using this code:
onClipEvent (keyDown) {
if (Key.getCode( ) == Key.LEFT) {
this._x = this._x - 3;
} else if (Key.getCode( ) == Key.RIGHT {
this._x = this._x + 3;
} else if (Key.getCode( ) == Key.UP) {
this._y = this._y - 3;
} else if (Key.getCode( ) == Key.DOWN) {
this._y = this._y + 3;
}}
I keep getting this in the Output window when I test the movie.
Scene=Scene 1, Layer=box, Frame=1: Line 8: ')' expected
View 3 Replies
Aug 12, 2011
I am trying to setup a movie where the user can move objects with the arrow keys. I have several objects that can be moved. My problem is that they all move at the same time. How can I fix it so you can click on an object and only that one object moves?
View 4 Replies
Mar 19, 2010
I have a simple animation that I would like to control the speed of the movie using the right an left arrow buttons. Keep pressing right arrow to speed up, and keep pressing left button to slow down.
View 4 Replies
May 16, 2003
How do I get the AWSD keys to work as smoothly as the arrow keys. I can put the arrow keys inside an enterFrame
[AS]onClipEvent (enterFrame) {
//move the tank
if (Key.isDown(Key.RIGHT)) {
[Code]....
If I put the AWD keys inside an enterFrame they run until I push another button
View 6 Replies
Apr 18, 2006
I have two buttons in my movie that move a movie clip up and down on my stage. the code in the buttons atm is as follows,
on (press){
if (this.pics1._y<-240) {
} else {
this.pics1._y = (this.pics1._y-10);
}
(this is just the down button)This just checks to see if the movie clip has reached its lowest position and if it hasn't it movies it down by 10px.What i would like to do it make is so when the button is clicked and held the movie clip moves down untill the button is released.(Im using Flash 8 with Actionscript 2)
View 5 Replies
Jul 14, 2009
The objective is to get the fox - by using the arrow keys - to move around on the stage and when he touches a duck the duck should disappear of the stage. The duck has a motion tween on it, to make it fly.Also if the fox touches one of the traps he should make a sound - using the redfox.wav sound in the library and disappear off the stage.I have this code on the actionscript timeline //Program to generate a set number of traps
//Declaring Variables var numOfTraps:Number; var movieWidth:Number; var movieHeight:Number; var counter:Number; //setting variables values for traps numOfTraps = 6 movieWidth = Stage.width; movieHeight = Stage.height; //Program to generate a set number of traps //Declaring Variables for (counter = 7; counter <= 13; counter++){ //Place 6 traps on the stage [code]....
View 11 Replies
Feb 1, 2010
I have three separate movie clips on the stage, while the mouse is over any movie clip I want the arrow keys (up,down,left,right) to navigate through the frames of that movieclip. The following code only seems to partially work. When I interact with a button on a movieclip the arrow keys only advance to the next or previous frame of the movie clip and then no longer work.
[Code]...
View 2 Replies
Apr 1, 2010
I need with a menu witch has 5 buttons moving along an ellipse. When I click on a button, I need to call an "arrow" movie clip, locate it BETWEEN the button being pressed AND center stage, and make sure it's pointing toward the middle. Much like the picture below: I've spent the whole week trying to make it work but I guess I don't know enough about AS2, or geometry to succeed on my own.
View 2 Replies
Mar 31, 2010
I have a file set up with a movie clip moving from side to side by itself and when it reaches the end of the stage it goes back in the opposite direction.[code]I know want to control the movie clips movement with arrow keys, just left and right so that it would stop when it reaches the edge and will only let me move it the opposite direction.I guess I'm just trying to set up a sort of template.
View 9 Replies
Apr 29, 2011
I have been using powerpoint all long for my presentations, but I'd like to move on with Flash. My question is therefore as follows: How do I use the arrow keys to go to the next frame and optionally, the left key to go to the previous frame?
View 2 Replies
Jul 29, 2009
For some reason, the down and right keys aren't working. They work fine in other programs but in this program they fail.
paddle_ybase = paddle._yscale;paddleSpeed = 0;
onEnterFrame = function(){
if(Key.isDown(Key.UP)){paddleA._y -= 1;}if(Key.isDown(Key.DOWN)){paddeA._y += 1;}
if(Key.isDown(Key.LEFT)){paddleA._x -= 1;}if(Key.isDown(Key.RIGHT)){paddeA._x += 1;}
steam(7);paddle._rotation = paddleSpeed;
} function steam(num){for(i=0;i<num;i++) {
[Code] .....
View 3 Replies
Apr 21, 2011
When I first put this code in, it worked.Now it doesn't Does anyone have any ideas as to how to fix it?[code]
View 4 Replies
Jun 29, 2010
im trying to make a navigation menu thats out of 5 buttons to go through them with arrow keys, right and left, figured i could do it with an array, but cant seem to work that out
View 2 Replies
Nov 18, 2003
how do you move an object around with the arrow keys.
But there's a catch.
I need my object to flip horizontal when pressing right when it is facing left ( and vice versa). And I need it to flip vertical when it is facing facing upwards and the down arrow is pressed (and vice versa).
View 4 Replies
Nov 1, 2007
I am trying to create a four button system that is controlled using either your mouse or arrow keys.I need to create a Key Listener to allow the highlighting and selecting of each button . The arrow keys allow you to select button when you reach the last button it returns to the first button, and the enter key allows you to select the button.
View 2 Replies
Nov 18, 2003
I know this has been posted many times before but, how do you move an object around with the arrow keys.But there's a catch.I need my object to flip horizontal when pressing right when it is facing left ( and vice versa). And I need it to flip vertical when it is facing facing upwards and the down arrow is pressed (and vice versa). Does anyone know how to do this?
View 4 Replies
Dec 25, 2003
I have the script so that you can controle a car with the arrow keys but for one of the misions on my gta2 style game i would like an enemy car to follow you. The car has to stay facing the right way acording to the way the street though, this is the only bit i cant think of i also need boundries.
View 3 Replies
May 15, 2010
I created an image, made it a movieclip and attached this code:
Code:
onClipEvent(enterFrame){
if(Key.isDown(UP)){
[code].....
View 2 Replies
May 5, 2010
I've got arrow buttons and a movie clip on my stage. I have an event listener for each arrow button for a MOUSE_OVER event that calls a handler function in my movie clip. The handler functions just call prevFrame(); or nextFrame(); What I want to happen is that the movie clip continues to play forward or backward as long as the mouse is over the appropriate arrow button.
Stage Code:
leftArrow.addEventListener(MouseEvent.MOUSE_OVER, imgBar.goLeft);
rightArrow.addEventListener(MouseEvent.MOUSE_OVER, imgBar.goRight);
Movie Clip Code:
function goRight(event:MouseEvent):void{
this.nextFrame();
}
[code]....
I'm not sure if MOUSE_OVER is the correct way to do this if I want the function to continue as the mouse even only happens once.
View 3 Replies
Jun 11, 2010
I made an image of an arrow and it is set as a button, not a movie clip.
I have made it so one of my scene loops, frames 65 to 85 and added a button to go to the next scene which is at frame 86.
The code I used is
on (release) {
gotoAndPlay(86) ;
}
But when ever I test the scene I get an error saying "Mouse events are permitted only for button instances".
I am using ActionScript 2.0
View 2 Replies
Apr 14, 2009
i have different scenes once clicked it goes to next similarly want to have right and left keys want to work with but its only working in the 1st Scene, once user clicks and goes to next scene then arrow keys stop working,
Actionscript Code:
import flash.system.fscommand;import flash.ui.Keyboard;import flash.events.Event;import flash.events.KeyboardEvent;btn_next.addEventListener(MouseEvent.CLICK,next_Slide);btn_prev.addEventListener(MouseEvent.CLICK,prev_Slide);btn_exit.addEventListener(MouseEvent.MOUSE_DOWN, closeApp);stage.addEventListener(KeyboardEvent.KEY_DOWN,
[code]....
View 1 Replies
Aug 17, 2009
i got my character to move left, right, down and up wit this code:
[Code]....
My question is, how can i block the up and down movement? I tried simply deleting some part of the script to block does movement from the user. But then the script would not work properly : s Here is the uploaded page i'm working on: link.
View 2 Replies
Oct 28, 2009
Is there a way to make it so that when you press the right key your animation/game goes forward a frame and when you press the left key it goes back a frame? I have a pretty minimal knowledge of actionscript so I'm not exactly sure how it would be done.
View 2 Replies
Feb 24, 2010
I'm making a Flash presentation for a client which I will eventually publish as a Projector movie...All the animated slides are in individual scenes, but the individual scenes have several stop points.My client wants to be able to use the left and right arrow keys to skip backwards and forwards to these stop points. They also want to be able to press the spacebar at any point to stop and play the movie manually.
View 1 Replies
Mar 2, 2010
How to make a symbol move with the arrow keys and wasd keys?
AS3 adobe CS4 premium
View 7 Replies