Keypresses In MX
How do can you make keyboard triggered buttons in MX. I can't seem to find a syntax example?
For example in Flash 5:
Code: on(keyPress "<Left>"){ trace("I'm hit"); } but how does this translate in MX style with keypresses???. I.e. for an onRelease:
Code: myButton.onRelease = function (){ trace("I'm hit"); }
Ultrashock Forums > Flash > Flash Professional
Posted on: 2003-07-23
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Help With Keypresses
Umm.... I have this problem with keypresses. I tried the tutorial given in Flash 5 for capturing keypresses. Now I want to use capturing keypresses in such a way that suppose there a biplane on the work stage and I press the left arrow or right arrow or any directional arrow for that matter, I want the plane to move one step in that direction. Can somebody please explain to me how to do this ? keep in mind, I'm a newbie to actionscripting. One thing I want to know is that whether I have to make separate frames of the plane moving in different directions.
PLEASE HELP !!
Keypresses
I know how to have Flash go to a frame when I hit the spacebar, but what if I want Flash to exectute a keypress when the playhead reaches a specific keyframe?
I've got it set up so that someone who cannot type can use voice commands, but I want the voice commands to translate into keypresses.
Keypresses
Hey,
Pretty simple question, but is there any easy way to check if any key is being pressed?
Thanks.
Keypresses
I am making a low-quality two player "TAG" game, and I already have a problem. I have discovered that with the simple code:
code:
on (keyPress "<right>")
{
this._x=this._x+5;
}
on (keyPress "<left>")
{
this._x=this._x-5;
}
on (keyPress "<down>")
{
this._y=this._y+5;
}
on (keyPress "<up>")
{
this._y=this._y-5;
}
on one "player," and the code:
code:
on (keyPress "<Insert>")
{
this._x=this._x+5;
}
on (keyPress "<pageUp>")
{
this._x=this._x-5;
}
on (keyPress "<Home>")
{
this._y=this._y+5;
}
on (keyPress "<End>")
{
this._y=this._y-5;
}
on the other,
I can not move both "players" at once.
Please help!
The file is attached.
More Keypresses
Hey, I remember in a tutorial on movement some things like: on keypress(left) x=-10, etc. or something like that. I've also heard that you can do regular letters like on keypress (a) or something, except, they are into numbers, does anyone know those numbers? like someone told me instead of a, lets say it was '14' so it would be on keypress (14) and then something else following that condition.
if so, can you make a chart, like a=##, b=##, etc.
thanks.
Keypresses In MX
i've got keypresses for up, down, left, right, control, and space. when you test the movie everything works. however, when you publish it, only the control keypress works. i'm at a total loss.
i'm publishing for flash player 7 and actionscript 2.0.
here's the snippet:
var listen:Object = new Object();
//
listen.onKeyDown = function() {
if (Key.getCode() == 37/*left*/) {
surface.onEnterFrame = function() {
surface._x += walkingSpeed;
person.gotoAndStop("left");
};
} else if (Key.getCode() == 39/*right*/) {
surface.onEnterFrame = function() {
surface._x -= walkingSpeed;
person.gotoAndStop("right");
};
} else if (Key.getCode() == 38/*up*/) {
surface.onEnterFrame = function() {
surface._y += walkingSpeed;
person.gotoAndStop("up");
};
} else if (Key.getCode() == 40/*down*/) {
surface.onEnterFrame = function() {
surface._y -= walkingSpeed;
person.gotoAndStop("down");
};
} else if (Key.getCode() == Key.CONTROL) {
surface.onEnterFrame = function() {
surface._xscale += (70-surface._xscale)/speed;
surface._yscale += (70-surface._yscale)/speed;
};
person.onEnterFrame = function() {
person._alpha += (0-person._alpha)/2;
};
}
listen.onKeyUp = function() {
surface.onEnterFrame = function() {
surface._xscale += (100-surface._xscale)/speed;
surface._yscale += (100-surface._yscale)/speed;
};
person.onEnterFrame = function() {
person._alpha += (100-person._alpha)/2;
};
};
};
Key.addListener(listen);
Help With Panoramas And Keypresses.
I've been racking my brain trying to think of the fastest and most neatly coded way of doing this. I have some panoramic images that I am trying to start in motion and, if the user presses an arrow key, will reverse it's direction. If somebody could please walk me through this, I would be extremely grateful.
Thanks,
Dan
Keypresses Not Working?
I'm working on something at the moment that uses keypresses to move an arrow up and down to select something from a menu.
On the arrow movie clip i have this code attached
onClipEvent (keyDown) {
if (Key.getCode() == 40) {
nextFrame ();
}
}
Where the next frame contains the arrow in its new location.
I have "traced" the keycode and when I run my program, the output window registers that i'm pressing the Down key, so that isn't hte problem. It just doesn't seem to want to move to the next frame??
The arrow is buried a few levels down from the main timeline, could this be a problem?
ANy help at all would be great!
Capturing Keypresses
Does anyone know how to capture keypresses??? in a message window of some kind???
KeyPresses Not Working
Flash MX Pro 2004
Hi
Im making an interactive presentation and on certain keyPresses the timeline moves to certain frames. I just had a few photos on the frames and had a button which had actionscript for
on (keyPress '2'){
gotoAndPlay (2);
}
and so on
I then added a frame which had a MediaDisplay component which linked to a Flash video file and the button had
on (keyPress 'v'){
gotoAndPlay ("VIDEO");
}
but now NONE of the keyPresses work at all.
Any suggestions?
M
AS3 Senocular KeyPresses Example?
Hi I was looking over his KeyObject.as and I could seem to get it to work can anyone send/host me a example .swf and .fla of this .as working?
Also does this allow multiple key presses and no delay?
AS3 Senocular KeyPresses Example?
Hi I was looking over his KeyObject.as and I could seem to get it to work can anyone send/host me a example .swf and .fla of this .as working?
Also does this allow multiple key presses and no delay?
http://www.senocular.com/flash/actio...s/KeyObject.as
Keypresses Are Choppy
I'm creating a virtual space shooter for a class assignment
I'm noticing a delay when I press the the keys and the movement is very choppy? My frame rate is set to 30
if (Key.isDown(Key.UP))
this.player.mesh._y -= 15;
if (Key.isDown(Key.DOWN))
this.player.mesh._y += 5;
if (Key.isDown(Key.LEFT))
this.player.mesh._x -= 15;
if (Key.isDown(Key.RIGHT))
this.player.mesh._x += 15;
Is there a better practice in actionscript to produce more fluid movements?
Capturing Two Or More Keypresses
Hi! I have a code that captures keypresses. It works ok if only one key is pressed but I need to capture multiple keypresses. Like ctrl + shift.
I tried using a AND (&&) statement on the if then else statement but it doesn't work. Here's my code:
PHP Code:
_root.createEmptyMovieClip("mc1", 1);
with(_root.mc1)
{
someListener = new Object();
someListener.onKeyDown = function ()
{
if(Key.isDown(Key.UP))
{
trace("up");
}
else if (Key.isDown(Key.DOWN))
{
trace("down");
}
else if (Key.isDown(Key.CONTROL) && Key.isDown(Key.UP))
{
trace("Up and Down");
}
}
Key.addListener(someListener);
}
I would greatly appreciate some help on this. Thanks in advance.
SetFocus And Keypresses
I have a dilemma.
I am setting the focus on a textInput box in the first frame of my movie.
This works properly and places a blinking cursor within the box when the movie is played and allows you to type into it.
What I need, however, is to be able to use
on (keypress <"Enter">)
or something like it to indicate when the user has finished typing in the textInput box.
This does not work because the focus is now on the box and not on the keyboard. Is there a way to make the <Enter> key affect the movie while the focus is still on the textInput?
Capturing Keypresses
how to know if one presses a key (with a keycode not from the list) ?
im trying:
Quote:
if(Key.isDown(Key.getCode(104)))do_something();
and it 'does_something()' if any key is pressed.
that's kinda lame question but thanks anyway
Multiple Keypresses
I did search the forums better this time and found nothing on this particula topic - I'm trying to figure out how to have an event on multiple keypresses rather than just one. For example I have:
---------
on (keyPress "<Left>") {
loadText=new loadVars();
loadText.load("audiophile.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
MainBox.html = true;
MainBox.htmlText = this.audiophileText;
}
}
}
--------
But rather than just on the "Left" key, I want it to be Left + 1 (holding them down at the same time). How can I do that?
General Keypresses
What I mean by 'General' keypresses is that there is no specific target, and no specific key. What I'm trying to do is have a screen and you can just press any key or click your mouse and it will call a function that checks whether there is a shared object already being used or it must be created (although you don't need to know that...).
I tried just
if(Key.isDown())
That doesn't work whatsoever.
crap, this shoulda been in the AS section...
Multiple Keypresses Help
Hi
Is there some actionscript that allows all keys to be pressed at the same time. At the moment, if you are holding down one key and then press another, it cancels the action that the first key was doing...
ActionScript With Keypresses...
I have an interactive character animation that I'm just playing around with, and I would like to know how to make it to where when I hold the down arrow my character stays in the ducking position....
I am just going to keep messing with this little project for the sake of learning a lot about actionscript and this was the first problem I encountered...
http://babosociety.non-no.org/HelpPlease.fla
Here is the file if you would like to see it, some suggestions on organizing it would be cool too if anyone has any...
This is my first character animation and like 3rd experience with ActionScript so ANY advise would be REALLY nice...
Arrays And Keypresses
Anybody know how to create and use arrays in flash? Im planning on making a game similar to Tetris.
Thanks
AS3 Senocular KeyPresses Example?
Hi I was looking over his KeyObject.as and I could seem to get it to work can anyone send/host me a example .swf and .fla of this .as working?
Also does this allow multiple key presses and no delay?
AS3 Senocular KeyPresses Example?
Hi I was looking over his KeyObject.as and I could seem to get it to work can anyone send/host me a example .swf and .fla of this .as working?
Also does this allow multiple key presses and no delay?
AS3 Senocular KeyPresses Example?
Hi I was looking over his KeyObject.as and I could seem to get it to work can anyone send/host me a example .swf and .fla of this .as working?
Also does this allow multiple key presses and no delay?
http://www.senocular.com/flash/actio...s/KeyObject.as
Capturing Keypresses
how to know if one presses a key (with a keycode not from the list) ?
im trying:
Quote:
if(Key.isDown(Key.getCode(104)))do_something();
and it 'does_something()' if any key is pressed.
that's kinda lame question but thanks anyway
Multiple Keypresses
I did search the forums better this time and found nothing on this particula topic - I'm trying to figure out how to have an event on multiple keypresses rather than just one. For example I have:
---------
on (keyPress "<Left>") {
loadText=new loadVars();
loadText.load("audiophile.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
MainBox.html = true;
MainBox.htmlText = this.audiophileText;
}
}
}
--------
But rather than just on the "Left" key, I want it to be Left + 1 (holding them down at the same time). How can I do that?
Silly Keypresses
FLA: http://www.matthewcorway.com/crap/re...undersgame.fla
SWF: http://www.matthewcorway.com/crap/retailblunders.swf
Can someone explain to me how to remedy my little stupid problem I am having...
When someone presses the left arrow, he is supposed to play the left run animation. When someone presses right, he is supposed to play the right run.
Now I've made games before, with this exact feature but I don't/can't see where my mistake is!
Can someone take a look? This is hilarious, yes.
Using 2 '<Enter>' Keypresses On Same Frame?
Is is possible to capture two '<Enter>' keypresses on a single frame?
I've got two textfields on a frame. Each one is its own button, which have different names. I want to be able to take the input from one or the other textbox after the user hits 'Enter' in that field. It works fine for one field, but not the other. If I change the second keypress to 'm' or something else, it works, but not when they are both 'Enter.'
Does anyone know of any way to do this?
Detect Multiple Keypresses
Is there a limit to the number of keypresses flash can detect at one time? I can detect three at a time, but the not a fourth using 'Key.isDown(x)'. Is there another way to get more at a time... as is always the way, I only need to be able to detect one more than I can at the moment.
Jamie.
Capturing Function Key Keypresses - MX
Hi,
I have run into an odd thing here. I'm using the key object to pull keycodes for nonstandard keys (function keys, etc) and tying to a movie clip. The script is triggered w/each keypress.
Here's the thing, just using onClipEvent (keyDown) and then putting some trace code under that, I should get a steady stream of trace text for any keypress in the output window. However, I receive hits on the trace code for all buttons EXCEPT F7, F8, F9, F10 and F11. I need to capture some of those F-keys as keypresses for me simulation work.
Odd! Anyone else run into this? Anyone have an explanation? I figured the keyDown event would be global.
Thanks,
B
Listeners Keypresses And Timers
Hello, Im currently attempting to recreate R-Type in Flash MX. Ive made alot of programs in Flash, so i am familiar with it, and basic AS, but im kinda lost when it comes to games.
Anyway, im sure im gonna have quite a few questions im sure you guys could help me with in 2 seconds flat, so i'll keep them all in this thread.
My first problem:
Im trying to create the "big beam" The powerful fire that used to be shot by holding fire (to build up) then letting go to release, in the origional R-Type.
Ive decided to just use a seperate key for this rather than the same button ive used for all the normal firing. please try and bear with me, ive never used listeners before, and neither have i used getTimer in a situation anything like this.
This is what i came up with to get the "big beam"(fire6) shooting on the release of control.
code: myListener = new Object();
myListener.onKeyUp = function() {
if (Key.isDown(Key.CONTROL)) {
setProperty (_root.fire6, _x, getProperty(_root.Spaceship, _x)+90);
setProperty (_root.fire6, _y, getProperty(_root.Spaceship, _y));
with ( _root.fire6 ) {gotoAndPlay (2); //plays sound
}
}
};
Key.addListener(myListener);
This has been put in a frame in the main timeline, it kinda works, but not how i want it to. When you press control it does nothing, howeva if you hold control and then press another key(eg M) on the release of M the beam will fire.
What do i need to do to this to get it firing on the release of control? and how would i go about including a timer that starts when control is pressed, then when released the value of the timer is passed to the x and y values of the "big beam" mc (fire6)?
I'll include the fla incase it makes it easier for you guys.The code duscussed is in frame 1 of the actions label, other revelent code is on the ship itself and the instances of the weapons (left of stage)
Thanks
Scott
HELP Why Does The UI Button Block My Keypresses?
Heeeelp I'm on a super tight deadline, I was making a Flash presentation and it was going just fine till now.
Here's the deal. I have several scenes.. that are basically slides. I have a hidden button (the traditional symbol button, not the UI component button), and it's invisible..but it has "on (keypress ...)" events on it. So the user can hit right arrow key to advance through the slides.
Now, the minute I put a UI component button down on a frame, the other hidden buttons won't catch keys anymore, even if they're on totally different frames, and totally different scenes!
What's going on? Any help would be AWESOME.. I have to finish this thing tonight or I'm dead.
Thanks!
EDIT: Actually, any UI component, once placed in my Flash document, will stop all other symbol buttons from detecting keypresses.
Checking Keypresses Problem
Hi guys!
I have a problem with checking keypresses and assigning certain events. I have an addListener object checking what arrow is pressed thus letting me know where I am on the stage. Then I have an onEnterFrame function with Key.isDown(Key.ENTER) which triggers an action. Everything works fine when in flash testmode.
PROBLEM: When I save it as swf or exe the arrows at first works but when I hit ENTER which fails then the arrows no longer work aswell. I don't get it!!
Btw, I'm using mx2004:as1.
//KeLLoGs
[F8] Limiting Keypresses To One Action. Help Please.
I have this code to create a flower, where the character is, when the space bar is pressed.
Code:
if (Key.isDown(Key.SPACE)) {
j++;
_root.attachMovie("pinkflower", "pinkflower" + j, 20 + j);
_root["pinkflower" + j]._x = _root.hero._x
_root["pinkflower" + j]._y = _root.hero._y
}
But at the moment this creates hundreds of flowers for as long as the space bar is held down for.
Can anyone help me so I can make this only happen once per each time the space bar is pressed?
Any Way To Do Multi-digit KeyPresses?
Just to verify, I'm not talking about multiple simultaneous keys, like Ctrl + 2. I have figured out how to do that.
What I need is to press two separate digits to activate a button. For example, 1 THEN 5. So when I press "1" nothing should happen but when it's followed by "5" (essentially typing "15" / fifteen) that would activate it.
Is there any way to do this?
Seems too simple to do on (keyPress "1"+"5") { ....
Prevent Certain Keypresses In Textfield
Hi all,
I'd like to prevent some things such as arrow buttons, tab, etc from working in an Input textfield. I've tried to use KeyboardEvent.preventDefault but the event isn't cancelable. How do I do this?
Detecting Keypresses From Within A Loaded Movie
I have a movie which monitors keypresses on the number pad of the keyboard and plays audio accordingly.
This movie works fine on it's own, but when I load it into my main movie it does not detect the keypresses.
Do I need a controller within my main movie (which would mean major restructuring) or can I do it all from the loaded movie.
Any help much appreciated.
cheers,
dave...
Multiple Keypresses To Action Movieclip
Hi
I have this code on a frame in the main timeline.
The timeline is looping, to see if the criteria of keypresses (CONTROL and SPACE) have been met.
Can anyone see why this isn't working
code:
if (Key.isDown(Key.CONTROL) and Key.isDown(Key.SPACE)) {
_root.control.gotoAndPlay(5);
trace("test");
}
Cheers
Referencing One Symbol For Mutiple Keypresses?
I've been playing around with some of the code that Smilev kindly helped me out with a few days ago , and I was just wondering whether it is possible to simplify it a little, making each case reference the same symbol, rather than needing to create a new symbol for each one. At the moment, if i reference the same symbol in each case, I can't change the XY coords for each keypress; they all seem to inherit the coords for the latest case, so every key plays the symbol at the same location on the stage.
I've included the code below, and attached my .fla file if anyone is able to help. The current code is a little bit broken, but i'm working on fixing it at the moment (pressing 'w' causes the second symbol to appear as a static image and shifts everything else off the screen). However, if it's possible to implement the thing i described above, I think this problem will go away by itself.
Code:
var sounds:Array = ["splash_1","splash_2","splash_3","splash_4"];
var n:Number=sounds.length;
var i:Number=0;
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (!done) {
done = true;
_root.i +=1;
switch (String.fromCharCode(Key.getAscii())) {
case "q" :
_root.attachMovie("Ripple", "Ripple_Anim" +_root.i, _root.getNextHighestDepth());
_root["Ripple_Anim"+_root.i]._x=105;
_root["Ripple_Anim"+_root.i]._y=105;
_root["Ripple_Anim"+_root.i].gotoAndPlay(1);
_root.mySound = new Sound();
_root.mySound.attachSound(sounds[random(_root.n)]);
_root.mySound.start();
break;
case "w" :
_root.attachMovie("Splish", "Splish" +_root.i, _root.getNextHighestDepth());
}
_root["Splish"+_root.i]._x=200;
_root["Splish"+_root.i]._y=200;
_root["splish"+_root.i].gotoAndPlay(1);
_root.mySound = new Sound();
_root.mySound.attachSound(sounds[random(_root.n)]);
_root.mySound.start();
break;
}
}
keyListener.onKeyUp = function() {
done=false;
}
Key.addListener(keyListener);
Thanks!
Tracking Multiple Simultanious Keypresses.
Dear Everyone,
I hope you all are fine. Brothers and sisters, I have one issue that I want to clarify. I am trying to create PureActionScript based game, and I actually have started working on it just yesterday. Its kind of a car driving game.
You can see it here: http://www.swiftshare.net/flash/beta/PureASGame.swf
And here is the code: http://www.swiftshare.net/flash/beta/PureASGame.as
Currently, if you press the right key, it rotates around its own axis. If you press the up key (which moves the car in the forward direction) and while pressing the up key, if you press the right or left key, the function the 'up key' was performing will cease, and it will start rotating. If both functions work simultaneously, we'll have a realistic kind of turning. But I don't know what to do.
I remember in AS 2.0, we had something like Key.isDown, that probably was what could work out. Now I know there's a guy who created a class that brings this thing back, but that too doesn't work.
In short: Is there a way to simultaneously detect two keys together. I mean there must be a way, people have created some awesome racing games in Flash, but I don't know how.
Please help me, thank you in advance.
How To Disable Keypresses On Tree Component
Is there a way so that only mouse clicks can affect a tree component?
I noticed that PgUp and PgDown cause the tree component to scroll - I'd like it to only scroll if they click the scroll bar (i.e. disable all key presses on the component).
Thanks!
Julia
Having Trouble Advancing The Timeline With Keypresses...
I have a menu (that contain buttons) that slides in when the bottom of the screen is rolledOver. The buttons on the sliding menu work to advance the timeline, but I also want the timeline to advance when a key on the keyboard is pressed (the spacebar, for example). That is the part I can't get to work. I tried to attach the "onKeypress" function, but it isn't working. Can someone advise me into what I'm doing wrong? I attached an swf. Thanks alot!
Recording Keypresses, Keeping Score
Hi all,
First off, I'll say that I realize that these are very basic questions that I have, and that there are probably tutorials out there that explain exactly how to do this. I have looked, though, and tried the Flash help file, but have had no luck working things out.
Alright, so... here's what I need to do (in as clear an explanation as I can give):
I need to design a basic experimental "game" for a research class. The subject is simply shown two images, and needs to decide if the two images were the same or different by pressing one of two keys (let's say "S" for same and "K" for different). The game needs to keep track of their input/accuracy. There are four different types of images that will be shown, though, and they're shown in random order (say 1-3-4-4-2-3-1-2...). The game needs to keep track of their accuracy for each type of image comparison separately. At the end of the game, the program should be able to show the results on screen (i.e. subject said "same", image was different... accuracy for image type 1 was 75%, etc.)
That's not too bad, right?
So I have the images showing up, for the time I want, without a problem. To make things easier, I've decided that I can rearrange the frames manually to create a random order, rather than trying to program the game to do this. Great. And that's where I am at this point. I can't get Flash to detect the "S" or "K" input, and I can't get it to keep a tally of the subject's correct answers. Obviously I'm not this far ahead yet, but I also don't know how I'll get the game to display the results at the end by tallying up the subject's input.
... and this is what I'm working on doing. Just to summarize, here are the things that I don't know how to do, but wish I did:
Get Flash to detect keyboard input. (I've found lots of tutorials about how to use the arrow keys to drive a car, move a bug, etc... but that's not what I need). Flash just needs to be able to tell if the subject pressed "S" or "K".
Get Flash to keep a tally of correct answers for each condition. I image this will involve using some sort of variable, and simply adding +1 for each correct answer. I also imagine that I'd use four variables, one for each condition?
Get Flash to call up the results of the game at the end. I'm guessing this would just involve displaying the current state of the four variables at the end, which should be easy (?).
I am NOT concerned about having to do a lot of things manually - if it doesn't HAVE to be automated, I won't bother trying to do it. For example, I mentioned I don't want to bother attempting to program random order. I also don't mind if I have to manually alter each input screen to know what each input would mean (i.e. I program the button after one trial to know that image type 3 was just presented, and the images were the same, so if the subject presses "S" add +1 to variable 3 and move on, otherwise just move on to the next image pair).
Rereading over this, I may have failed at making this clear. But if anyone has ANY advice, even if it's only for one part of my problem, I'd appreciate it. Links to tutorials would also be appreciated.
Cheers, thanks for your help!
Creating Line Drawing From Keypresses
I want to create a line drawing based on key presses. Each key press will relate to a predefined xy co-ordinate on screen and when the next key is pressed a line will be drawn between the two and so on for the next keypress.
Having placed a node for each key on the screen I have compiled a list of all of the x co-ordinates (there are 21 values) and a list of all they co-ordinates (there are 3 values). For these I have created two arrays, one lX and one for Y, so that I can create values for each letter
Q [0] [0]
x = 65.8 (1st number in Array X)
y = 65.8. (1st number in Array Y)
Array X [65.8, 83.8, 101.8, 119.8, 137.8, 155.8, 173.8, 191.8, 209.8, 227.8, 245.8, 263.8, 281.8, 299.8, 317.8, 335.8, 353.8, 371.8, 389.8, 407.8, 425.8]
Array Y [65.8, 101.8, 137.8]
Basically I am unsure of how to relate the x and y values of the letters to the keypress. I.e.
Keypress 1 = B
Keypress 2 = A
Keypress 3 = D
Keypress 2 = G
Keypress 2 = E
Keypress 2 = R
Etc…
I find coding very difficult, so if anyone would be able to explain this it would be greatly appreciated.
Many Thanks
Helen
Multiple Keypresses To Execute A Movie Clip?
Hi guys,
I have this code on an invisible button...
on (keyPress "c") {
mc.gotoAndPlay(2);
}
This works fine.
How do I add to the keypress?
Rather than pressing 1 key - I want multiple keypresses in a correct sequence, which, if correctly executed plays my mc.
Thanks
Stacking Buttons Looking For Same Keypresses -- How To Control Which Button Responds?
i'm really stumped.
i'm working on a project which has a bunch of stackable menus and submenus. i have a keytrapper that looks for keypresses on the main menu (up and down arrow) and moves the selection bar accordingly. when the user hits enter, it launches a sub-menu. the submenu also has up/down navigation via a keytrapper, HOWEVER, all the up/down keypresses are grabbed by the main menu and not the submenu.
how do can i tell flash to pass keyboard input to the keytrapper in the submenu when the submenu is active, instead of the keytrapper in the main menu always taking presidence?
i've tried the following with no luck:
+ button.enabled=false on the main menu keytrapper when the submenu is launched
+ selection.setFocus("submenu")
+ having a variable keeping track of which menu is active and having the keytrappers in each menu look to see if they are a match to the curernt variable setting. in other words, a dirty focus hack. problem is it doesn't work -- it prevents the main menu from scrolling, but the submenu won't scroll either.
the best luck i've had is if i leave both keytrappers active, i can move down in both menus if i press the button very quickly.
please, if you have insight, pity this poor fool and help me unlock the secrets button priority.
Anyone Have Code To Insert Keypresses Into A Text Field As If Real Key Were Pressed?
I want to create an onscreen keyboard where when you click an onscreen key
it inserts
the appropriate characters into a text field, at the text field cursor
point, i.e.
just like if they'd pressed the key on the keyboard.
Anyone have code for this?
Tried it myself, on a button click, however when I do something like
_root.mytext.replaceSel("A");
It puts the A in the beginning of the field, no matter where it was before.
If I setFocus() to the field first,then it selects all the text (not what I want). But if I don't setFocus() then the begin and end index are -1, i.e. I have nothing selected because I've just clicked on the onscreen key button.
Help, I'm a bit stuck.
Dino.
Multiple Keypresses - Multiple Events... WAA
Hey fellow flashers. I'm programming a little big game here. You control a character (viewed from the top) with the Arrow keys.
- The left/right keys rotates the character 5 degrees
- The up/down keys move the character 1 step forward/backward
The problem: Because rotating and walking are not necessarily combined actions, I separated the keypress captures and the attached action. But when you press both keys at once, the character stands still and wonders why he's programmed the wrong way...
Strange: Of 10 PC's I tested on, there's 1 where combination of keys does work. But I can't figure out the difference in configuration...
Any suggestions are welcome!!!! Thanx!
|