ActionScript 3.0 :: Keyboard Control Of Two Objects At One

Dec 2, 2010

Working on my first complex game, and I'm not sure how to best approach this problem. I've got a submarine whose motion is controlled by the four arrow keys and which launches torpedoes via the space bar. After the sub shoots, I want the torpedo to be steerable with two other keys (probably Z for left and X for right), and at the same time, have arrow keys continue to control the ship.

First question, is this possible? I'm assuming I'll have to switch focus back and forth via code.

Second, what the best approach to setting this up? Attach listeners to the stage or to each object? If I chose the former, could i avoid focus issues by detecting which key was pressed and then manipulating the appropriate object?

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Keyboard Events (movie Clip Moves Via Keyboard Control) And Scenes

Nov 7, 2009

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.

[Code]...

View 5 Replies

ActionScript 1/2 :: How To Set Keyboard Control

Jul 12, 2010

is the following scripts correct to stop animation by pressing "Space Bar" if the animation is playing. And to play the animation again if the animation is paused. Is there any additional criteria need to be added to make it more solid.

keyListener = new Object();var isStopped : Boolean = false;keyListener.onKeyDown = [code]....

View 1 Replies

ActionScript 2.0 :: [CS3] Control By Keyboard And Buttons

Dec 22, 2008

I am creating a game where the user can control the character either by left or right keyboard buttons or by clicking on a left of right movielcip buttons. Currently, I can control the character using the keyboard but I cannot figure out how to add the MC button control. Here is my current code attached to the character_mc:

onClipEvent (enterFrame) {
if (_root.background_mc._x<=-3620) {
_root.background_mc._x = -3620;

[Code].....

Can I add another listener for either movieclip button (left_btn_mc, right_btn_mc) to the above code, or do I need to add the code to the each movieclip button?

View 7 Replies

Professional :: Use Buttons To Control Keyboard

Sep 4, 2010

What im trying to do is create 8 button in flash using as2 to control certain keys on the keyboard. When i click a button ive created in flash i want it to trigger a key eg. "a"

View 1 Replies

ActionScript 2.0 :: Control Animation With Keyboard?

Jul 12, 2005

I'm trying to create an input field where a user types a word and if correct, the movie progresses to the next frame (I just can't don't know how). More importantly, I wondered if there was a way to substitute clicking on a button with hitting a key on the keyboard? So instead of using a "submit" button to check the field's value... the user can just hit the "enter" or "return" button and the "if" and "gotoandplay" actions will occur.

View 7 Replies

ActionScript 3.0 :: MovieClip/keyboard Control?

May 27, 2009

OK, so im trying to make a seemingly simple as3 project where I instantiate a movieclip from the library, and then move it using keyboard controls. I got it working fine using ye olde as2 method (all the code on the timeline of the .fla), but i cant get it to work using the as3 .as file method (if that's the right description).

[Code]...

View 4 Replies

ActionScript 3.0 :: Prevent Keyboard Control Of Slider?

Aug 28, 2009

I'm using the slider component to control the volume of an MP3 but also need to use the arrow keys to move a character. When you place focus on the slider component, the arrow keys move the slider rather than the character. How can I disable keyboard control of the slider altogether? Is there a way to do it temporarily.

View 1 Replies

ActionScript 1/2 :: Keyboard Control In Flash Presentation

Jul 13, 2010

I created a presentation in Flash. And I embedded the following keyboard control scripts so that I can pause the slide by pressing "Spacebar" and play it again by pressing "Enter".[code]I also embedded getTimer script to delay the speed of the flow so that key-point can be loaded one by one.[code]Other than the above keyboard control, I also add four buttons at the right bottom so that I can play and pause, fast forward and rewind by clicking those four buttons.

1. the 1st and 2nd slide cannot be paused by the above keyboard control command.

2. the play and pause buttons at the right bottom is not functional in the 1st and 2nd slide.URL...

View 8 Replies

ActionScript 3.0 :: Class To Control Keyboard Input For An Mc?

Aug 1, 2011

I have some AS2 code for responding to keyboard input - it was great because it added friction, thrust, gravity etc... ie: it made the movements very real and added playability which is key in engaging players. On passing it into classes for OOP I don't seem to have got it right. maybe somebody knows a nice tutorial for the same.It was Emanuel Feronato's tut in AS2

RocketMainDocClass
package import flash.display.MovieClip; import flash.events.*;  import flash.ui.Keyboard; public class RocketMainDocClass extends MovieClip{

[code].....

View 4 Replies

Playback Component Accessibility - Control With Keyboard Commands

Sep 14, 2009

Can you tab into CS3 Playback components or control them with keyboard commands in a regular (non screenreader) browser like IE? If not, can you in CS4? I believe that all screen readers can control Flash playback now, correct? But I have a higher up who wants it to be keyboard controlled as well.

View 4 Replies

Walking Animation (MovieClip Control By Keyboard Events)

May 2, 2009

I have two MovieClips, and both are controlled by keyboard events. One is a globe that I want to rotate in one direction or the other. The second is a walking animation that should change direction or stand still depending on which key is pressed or if none are.

Here is the AS Code:
/*var rightDown:Boolean = false;
var leftDown:Boolean = false;
var upDown:Boolean = false;
var downDown:Boolean = false;*/
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
[Code] .....

You can see that I've tried a few different methods, but neither has worked correctly. Using the timer came close, but then the globe kept speeding up, and I couldn't get the walking animation to default back to the standing animation. Here is the .fla [URL].

View 1 Replies

ActionScript 3.0 :: Simple Stop And Play Keyboard Control

Aug 31, 2009

needless to say, new to as3... What I want to do is control start and stop of stage playhead with keyboard control. What I have so far is the stop control, but cant figure out the play. I have tried setting a var and boolean, but am doing something wrong =(
// heres my code

[Code]....

View 2 Replies

ActionScript 3.0 :: Making A Keyboard Event Control A Button?

Dec 12, 2010

how to make an keyboard event listener control a button to have it make a sound. i am making a drum kit that you will be able to play using specific key on the keyboard. i have it built and functioning with just using mouse clicks but for my end result i would like to have the keyboard and mouse be able to control it.

View 1 Replies

ActionScript 2.0 :: Make Keys On Keyboard Control Flash Timeline?

Feb 4, 2009

I have a simple flash project with a TV and a remote control. right now there are arrow buttons on the remote control that i have setup so that when you click on the button it goes to another frame. now my client wants it also setup so that when they hit the arrow buttons (up, down, etc) that it goes to a certain frame.

View 6 Replies

Allows The User To Control A Infinite Wall Of Photographs In Space With The Keyboard?

Jul 15, 2010

I recently stumbled upon a site called 'The Influence Project' which allows the user to control a infinite wall of photographs in space with the keyboard.You can check out the site here http:[URL]....

View 2 Replies

Professional :: Flash Movie Where Presenter Can Control Stops With Keyboard Key?

Aug 27, 2010

I do not know how to insert an animation stops to give the presenter time and forward or backward in a linear and PowerPoint by pressing any key. Similar to typical PPT slideshows and will insert a small clip light and animation films. "My idea is that every time they click on any key (no button) on the film, forward motion up to a certain frame and so on until the end of the presentation "

View 1 Replies

ActionScript 3.0 :: Keyboard Control - BACKSPACE And ENTER Keys Are Not Working

Oct 20, 2011

I have the follwoing code to control a Flash-based presentation but BACKSPACE and ENTER lkey are not working. I am puzzled. PD: All the rest of the keys works fine.

[Code]...

View 3 Replies

Actionscript 3 :: Remove Keyboard Control On Flash Slider Component?

Apr 6, 2011

by default the flash slider component can be manipulated with the keyboard. Is there a way to disable this behavior so that users can only drag the slider component with their mouse?

View 3 Replies

Flash :: PC Control - User Mouse Clicks Or Eventually Keyboard - Pressing Some Keys

Nov 23, 2009

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.

View 2 Replies

Actionscript 3 :: Control Character Made With Adobe CS4 Bone Tool Via Keyboard Buttons?

Jan 22, 2010

Is there any way to control a character made with Adobe CS4 Bone Tool via keyboard buttons? Its limbs are linked up by IK chains built by Bone Tool.

View 1 Replies

Flash :: Flex - Click Event - Objects On Stage To Be Listen To Mouse And Keyboard Input

Oct 19, 2010

If I plan to implement 100 objects on stage to be listen to mouse and keyboard input, is using "function" call responsive enough? How good does eventlistner work?

View 2 Replies

Control Many Flash Objects At Once?

Aug 25, 2009

I have 10 different buttons and I want to toggle their visibility with one command. How do I group them to achieve this?

View 3 Replies

ActionScript 2.0 :: Using Textfeild To Control Objects?

Feb 18, 2009

I do not know if this is possible but I want to use input field to program things on the stage.

I know if I do this

onEnterFrame = function() {
mars.text = onEnterFrame = function (){ my_mc._x +=5 }
}

it works...I was wonder if their was away to do that using input.

View 0 Replies

ActionScript 2.0 :: Create A Keyboard Shortcut Using A The Control Button Plus A Key Button?

Dec 28, 2005

Is there any way to create a keyboard shortcut using a the control button plus a key button. For example, if I want to print the screen, I would press control + p.

View 5 Replies

AS3 :: Flash - Control Scaling Of Objects During Fullscreen?

Aug 12, 2011

I have flash ui built over the chromeless youtube player right now and I'm wondering if there is anyway to set certain sprites within the stage to not scale on fullscreen without having to do inverted scaling.

Edit: I use FlashDevelop as my IDE and building this purely in as3

View 1 Replies

ActionScript 2.0 :: Control The Volume Of The 3 Objects Separately?

Sep 20, 2005

On frame 1 from the root I've the following script:

[Code]...

For some reason all three sound objects play at 5% of the volume (the volume that was set for "WhenTextAppears"). I want to controle the volume of the 3 objects seperatly,.... I thought the code above should do the trick but it doesnt.

View 1 Replies

ActionScript 2.0 :: [MX] Control Volume Without Using Sound Objects?

Dec 18, 2003

I have some sounds in movie clips, this is because that is the only way to be able to select SYNC Stream mode (to keep the movie in sync with the narration). Thus I don't want to use Sound Objects because they can get out of sync... Is there any way to control volume (so I can mute) without using Sound Objects?

View 2 Replies

ActionScript 2.0 :: Cs4 : Control Number Of Objects Falling At The Same Time?

Oct 25, 2011

I have a fixed amount of words. Lets say 20 words. I want each of these words to be put into symbols - so i have 20 symbols (box1...box20). Now i want the boxes to fall from the top of the screen and until they reach below the screen. But (and this is where i'm lost) I want to have them fall at different speeds AND I want to control how many boxes falls at a time. Starting out with one box and when this box is out of the screen I want to control the amount of boxes/symbols entering the screen next.

A function telling that next there should be i.e. three boxes entering and falling/floating across the screen (from just above the top of the screen untill they all have reached the bottom). And i want to be able to call a function which starts X boxes - even before the existing boxes in the scenes has dropped). It would be nice to have a function, ie. fallBox(3) , which may be called at any time.

View 5 Replies

ActionScript 3.0 :: Control An Object Referring To Array Objects?

Oct 23, 2008

Using AS3, I was wondering how to control one object, a ball, while another ball bounces around. I'm modifying code from "Foundation ActionScript 3.0 Animation" by Keith Peters.

I'm pretty new so I'm probably making some obvious mistakes here. First of all I thought I could refer to the balls as ball[0] and ball[1] since they are in an array called ball. Is this correct?

[Code]...

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved