ActionScript 2.0 :: Moving A MC By Pressing Letters On The Keyboard?
Oct 16, 2005
I posted this question before , but never got an answer that I understood or could get to work - so now that I have something to show I thought I would post it with the question again.
Have a look at this :[URL].. Now, once the screen says "GO!" I want player 1 to be able to move that blue horse across the screen to the finish line (where it will have a hitTest to decide the winner).
I'm trying to play a movie by pressing a keyboard key. "B" for example. It stops playing automatically. But when I press the key again it should start playing from where it stopped.
There are 5 movieclips on the stage (btn0 to btn4). I wanted to change focus pressing Keyboard.UP and Keyboard.DOWN. But the focus changes not in correct order. It jumps in mysterious way from 0 to 2 and so on.[code]
For the last few months I've been just experimenting with different actionscript elements, and Ive slowly built up a stick figure to move around on the Stage. He can collide with platforms, jump, etc. and there is an appropriate animation for each movement, and there is gravity effects, you get the idea.Well, normally, I just use the following method to activate a animation when I press say the Right Arrow Key:
if (Key.isDown(Key.RIGHT)) { guy.gotoAndStop("runRight"); guy._x+= moveSpeed;
Im Using Flash Basic 8, Here is what I am trying to do:
For the last few months I've been just experimenting with different actionscript elements, and Ive slowly built up a stick figure to move around on the Stage. He can collide with platforms, jump, etc. [code]...
But the problem is, the Movie Clip associated with the frame "punchRight" does not loop. It just goes to the first frame and stays there. I verified that the issue was not the Movie Clip or the frame by replacing the D Key, with the Right Key, and the animation played as I would expect.
how to change the directional arrows to keyboard letters on keypress. the browser scrolls when i press arrow up and down arrows and it's quite annoying. i just want to change the keypress of up arrow to w, then left arrow to a, right arrow to d and down arrow to s. just one of any will do then i'll do the rest.
here's the code:
function detectKeys() { var ob = _root.char; var keyPressed = false; if (Key.isDown(Key.RIGHT)) {
I'm trying to setup an interface where an event is triggered by the user pressing a key on the keyboard. So far I have the following code in a button on the stage:
Code: on (keyPress "a"){ trace("you pressed a") } on (keyPress "b"){
[code]...
Which works fine. I was wondering if there was a way to either remove the case sensitive properties of the keypress action, or to force the keyboard to return a caps lock or something. The only way I can think of doing it so far would be something like this:
Code: on (keyPress "a"){ trace("you pressed a") } on (keyPress "A"){
[code]...
Which obviously will double the amount of code needed - especially as the event for a small c and a capital C would be the same.
I'm completely new to AS3/Flash programming, though I program in C/C++/C# in my job. These days I got a project idea which I think Flash would better fit than the other languages I mentioned above. I want to create an on-line automation application that can:
1. Control user mouse clicks, or eventually keyboard, pressing some keys;
2. Communicate/connect to the user's bluetooth device, establishing connections to the mobile devices attached to it - the web application in this case would act as a server.
Here is the code I am currently using. (The instance name being mcBox)One problem I am having is a slight delay between pressing the key and the symbol moving.Another problem is I would like the movieclip symbol to play its own timeline when a key is pressed.
I followed the tutorial Mouse Trail and ended up with the codes below, but de thing is the whole log of text moving instead of each letters follow the previous one.
I'm exploring menu's in flash and I'm currently trying to put together a thumbnail menu where thumbnails are contained in a Parent MovieClip.I want to then be able to move that movieclip along the stage (to the left or right, depending on the keyboard key pressed)..I know I can do this using this code, when the Parent MovieClip
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);function myKeyDown (e:KeyboardEvent):void{ if (e.keyCode == Keyboard.RIGHT){my_mc.x -=125; }
I made a symbol and attached a class to it, and now I want to move the symbol according to which keyboard-button I press.. I've googled several times, and all resulted in some vaque tutorial from which I couldn't underatdn anything at all.
I'm making a two player pong game using flash mx and I followed this tutorial to get to grips with moving objects (the bats) up and down. I got through the tutorial fine but it doesn't make the objects move smoothly. they jerk then pause before moving normally, which would be no good for the game. I found this game on newgrounds which has the pads moving as I'd like them to.
I try to move my existing movie clip using keyboard.. I want to clear how i can move mc.. For example if i click errows.. or for example if i click N i must move mc to right position. But i can not clear why my arrows working and N not
Code: stage.addEventListener(KeyboardEvent.KEY_DOWN, starMoving); function starMoving(event:KeyboardEvent):void { switch (event.keyCode)
I'm making a game in AS3 and I need to move an object from left to right using the keyboard, it works fine but the problem is that when i push left or right the object moves but not in a fluid way, I assigned to movement to KEY_DOWN but first it moves the ammount of distance i gave up then pauses for half a second and then I moves fluid in the direction i gave. Now my question is how do I need to program it so that when I push the button it move fluid in that direction immediately instead of taking a little pause?
I have an object like a ball i want to be able to control it and make it as if it jumps up and down and moves to the right and left with the Keyboard how can i do this please?
I want this code to move my map i.e map_mc when the keyboard keys are pressed. When I add it to the map_mc, I see no effect what do u think I am messing with.
Here's my situation, I'm making a stick fighting game, where this stick figure fights others. I have the basic moves done inside a mc. I just tried to use Kirupa's tutorial on how to animate that bug with the keyboard arrow keys, but it didn't work. It moved the whole screen. All I want to do, is when you press the left or right arrow keys, the movements (the mc's name) move to the left/right. I attached the .fla. The basic controls are the left arrow animates it left, the right animates it right, and the enter key makes him punch.
I have 2 scenes. In both scenes, I have a movie clip that moves via keyboard control. If the goto next scene is triggered by the movie clip in the first scene the keyboard control works in the second. However, if I use a button to move to the next scene then there isn't any control over the movieclip in that scene. I've traced the keyCode in the second scene and it is picked up but the switch statement doesn't run. I'm migrating to Actionscript 3.0 and updating something I created in 2.0. I would like to do it without writing a class.
When using a notebook and I have remarked that I cannot enter numerical character with shift + a letter to enter number.Is this a bug in flash ? How to circumvent this ?
How do? Edit the field with numeric keypad, not a full keyboard my code: <s:TextInput text="{TransactionObject.cartao}" id="item" restrict="0123456789" /> app for Android and playbook
I get an error while extracting the asdoc of my flash professional project:
Code:
C:...Main.as(33): Spalte: 73 Fehler: Access of possibly undefined property D through a reference with static type Class. private var moveRightArray:Array = new Array(Keyboard.RIGHT, Keyboard.D); ^ C:...Main.as(33): Spalte: 73 Fehler: Access of possibly undefined property D through a reference with static type Class. private var moveRightArray:Array = new Array(Keyboard.RIGHT, Keyboard.D);
im currently making an "AS3 beat em up" ala streets of rage or double dragon.Currently i have my character moving and a few animations done and i am trying to figure out how to make attacks work.I have some "basic" animation for his attack, but im not sure how to get it to work correctley.What happens is, if you press control (the attack button) whilst the character is walking he just keeps moving and is stopped on the attack frame.I want the character to stop moving if the attack is pressed and once it is released start moving again.
hero.gotoAndStop('still'); var left:Boolean = false; var right:Boolean = false;[code].......
what i have is a tween on a movie clip of a popcorn kernel on one layer and a tween on a button on another layer to follow the movie clip. i want to be able to roll over the kernel and make it "pop". i changed my over on the button to popped corn (this works) but i want it to stay popped for the rest of the tween.
How can I differentiate between these two actions in AS3? I'm working on a side-scroller,and I want to require the "attack" button to be pressed for each successive attackCurrently you can continuously attack by holding down the attack key. I'm using a standard event listener, i.e.
ActionScript Code: private function keyDownFunc(event:KeyboardEvent) {
I have two buttons when the user selects both buttons I want to display a movie clip. Basically I created a mouse down event to set a variable name for each button. I also created an on enter frame event that is listening when those two variables are true. When they are true I display a movieclip. how can you press two buttons at the same time and the answer is this is for an air app for ios. So the user can have one finger on one button and another finger on another button when both buttons are selected display something.
I had something along these lines:
Code: private var _isWinActive:Boolean = false; private var _item1IsSelected:Boolean = false; private var _item2IsSelected:Boolean = false;
sience I've heard that you are quite experienced in flash I wonder if you would like to help me with a little problem of mine.what I want to do is that I want to get two different effects while pressing down one key.