Flash :: Move MovieClip Using Onstage Buttons, Not Arrow Keys
Mar 23, 2010
To move the MC, using arrow keys I used the following and it worked:
var timer:Timer;
var direct:String;
initStage();
[Code].....
I tried to convert this to use my onstage buttons: up_btn, down_btn, left_btn, right_btn to move MC box but couldn't figure it out.
View 1 Replies
Similar Posts:
Aug 7, 2010
This actionscript 2 for moving a movieclip on stage in actionscript 2 .I would like to know what is the syntax in actionscript 3 .
movieclip.onEnterFrame = function(){
if (Key.isDown(Key.LEFT)) {
this._x -= 5;
}
}
cheers im new to actionscript 3 but nknow i need to make the change now.
View 9 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
Jun 24, 2010
so first off, this is AS 2.0. Second, i have a little character from a tutorial on how to move an object around with the arrow keys. The character faces on way on "up" another on "down" and so forth. There are 4 frames for it facing up, down, left, and right so that on the key presses it faces the proper direction and moves accordingly. I also want this little guy to move behind objects. When this happens, i want the object that the little guy is behind to be partially transparent so that you can still see him and he doesnt just vanish.
[Code]...
View 3 Replies
Nov 9, 2010
Ok basically what is happening is that i play my game and when i die i goto the game over screen. once i click the play again button it goes back to the beginning but there's a problem. the arrow keys will not move the character left or right.So a few ideas is that the
Code:
onclipevent(load)
is not resetting the variables on the next play. Another is that the
[code].....
View 1 Replies
Oct 18, 2011
In Fash CS3, suddenly, in certain files, I can't move an object left using arrow keys - but I can move the same object right, or if I hold down Shift + left arrow, it works correctly Also - I can move the object down with arrow keys, but not up Workaround - move an object on a different layer, then return to the problem object and it moves correctly. But this doesn't last long, the problem resurfaces.(I've tried rebooting; tried copying all the layers into a new file.
View 1 Replies
Jun 8, 2010
My character's name is character. When left and right are pressed it tells me what's being pressed when I run it - it says there's no errors with the code. My character doesn't do anything though! [code]...
View 5 Replies
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
Jun 26, 2011
so at the moment i have this in my maze game...[URL] i want it so i can move the circle with my arrow keys, which i can do and then when it hits the walls it makes them go back to the losing screen however i have tried but i cant seem to get it to work. i know maze games are newby but i am new =]
View 2 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
May 21, 2011
you know how in some flash game the camera always follow the main character, and you move the character with arrow keys?
View 1 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
Sep 16, 2011
how can i make an object move with arrow keys on my keyboard, i am using as3.so when i hit the left arrow, it moves to the left etc..
View 5 Replies
Jan 27, 2011
i'm attempting to make a platform game, i know how to move left and right with the arrow keys, but that's quite boring. i want to move my character based only on the x movement of my mouse. the more i move my mouse in a certain direction, the faster the character moves in that direction. i've been trying to modify the x-speed on my character based on a x value of the mouse, but nothing is working.
preferably, i want a code that keeps my cursor at the center of the screen, while still being able to detect x movements of the mouse. i'd copy paste code from my program, but i'm fairly confident that doing so will serve no purpose. i need a new direction. i have no idea how to do this.
View 9 Replies
Oct 20, 2009
I can't seem to find any examples where You can scroll a movieclip (not text) with arrow keys
View 6 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
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
Sep 13, 2009
I just made a new Flash project. It lets you move a Cube, with the arrow keys on the keyboard.
Code:
function hearKey(yourEvent:KeyboardEvent):void{
if (yourEvent.keyCode==Keyboard.RIGHT){
cube_mc.x+=5 };
if (yourEvent.keyCode==Keyboard.LEFT){
[Code] .....
It works perfectly fine, except for example: I press down the down key. It moves down (good so far). I keep pressing the down key down and also press the left key down. Now it moves left(not so good, I want it to move both left and down, how do I do that?) Now I release the left key but am still on the down key. Nothing happens....(I want it to then continue going down).
View 1 Replies
Mar 3, 2010
I've a flash games site, and Im having a lot of difficulties to make it show in internet explorer 8.When you are playing any flash, the arrow keys that should belong to the flash scroll the page up and down (probably left and right too). This was happening in both ie7 and ie8.I placed the flash inside an iframe, that fixed to IE7, but the problem persists on IE8.If I change the flash wmode from transparent to window, the page stops scrolling, but this breaks all my menus and banners, that get hidden behind the flash when they expand.How can I place a flash, with wmode transparent, and make arrow keys work in the expeted way in IE8?
View 3 Replies
Mar 12, 2007
Basically I wanna remove my mc "ball" when you press the left arrow key. I've tried stuff like
Code:
if (Key.isDown(Key.LEFT)){
ball._x -= 1;
}
Some reason gives me like, "needs clip events"
View 6 Replies
Dec 28, 2010
The following code (with a textField on the stage named "textTest") will trace and display on the stage the Key Code of the key pressed. When done within the IDE, and any other browser, it works fine. However, when tested in Firefox 4 (for Mac), everything works except the arrow keys.
package {
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
public class test extends MovieClip {
[code]...
View 2 Replies
Mar 26, 2011
I have a flash embed code in my webpage. When playing the game, page is scrolling with Up and Down keys. How can i prevent this? Firefox is ok, but it's only scrolling in IE.
View 1 Replies
May 31, 2011
The following code works properly in flash player 10.1 but not 10.2
ActionScript Code:
function setup() {
stage.addEventListener(KeyboardEvent.KEY_DOWN, displayKey);
}
[Code].....
View 0 Replies
Sep 9, 2010
I am a beginner to flash gaming. I am making a platform game, but can not reverse my character when he goes backwards. This is my code for left and right: if (Key.isDown(Key.RIGHT)) {_x += speed;} if (Key.isDown(Key.LEFT)) {_x -= speed;} How Can I reverse it so when it goes LEFT, the character turns all the way around?
View 4 Replies
Mar 7, 2011
I'm creating a website where I want to navigate through the menus using the Arrow Keys and by hitting the Return Key..it launches that selected page.
View 1 Replies
Sep 11, 2010
I've got a form that the user enters numeric values in to a series of text Input fields. I want to allow the user to use the arrow keys in addition to the tab keys to control the active focus of the fields.
I set up a 2D array with the names of the input fields as values. I'm trying to call the name of the input field from the array and then assigning the focus, but I'm getting Error 1067 implicit coercion errors.
stage.focus=nextCellName;
stage.focus=prevCellName;
Code:
import flash.text.TextField;
import flash.events.MouseEvent;
[Code].....
View 2 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
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