ActionScript 2.0 :: Detect A Key Press?
Jun 10, 2010In this part of my game what I need to do is listen for the key to be pressed down which will go hand in hand with a hitTest to remove an object.[code]...
View 1 RepliesIn this part of my game what I need to do is listen for the key to be pressed down which will go hand in hand with a hitTest to remove an object.[code]...
View 1 RepliesI am trying to detect the press of the function key f4. It works find in publish mode on my pc with keyboard shortcuts disabled.Once put on the web the f4 key opens the address bar of Explorer. How do i detect the keypress of F4 do do actions in my flash movie.[code]
View 1 RepliesDetect a keyboard press in it?This is my [code]....
View 10 RepliesI'm having a spot of trouble with keycodes, for some reason my program is unable to detect when i press any key but the space bar, even when i run a trace on the last key pressed it dosn't bring up a code on any other key but the space bar, : in the output box, when i press the space bar i get this message:
Key Pressed: (character code: 32)
but if i press an arrow key i get this message:
Key Pressed:
it cant even find a code .here is my code: ;[code]....................
i have 10 buttons on stage. bt01,bt02,bt03...for every button in my code i have bt01.onPress = function()all buttons call the same function: animation(this);How can i detect any button pressed? i dont want to use bt01.onPress. etc etc. etc... they are not Dynamic.something like buttons.prototype.onPressed = function(){animation(this)}or a for..i tryied for but it only work with dynamic buttons.
View 1 RepliesI'm detecting key presses with the follow code:
main.as
ActionScript Code:
package
{
import flash.display.MovieClip;
[Code]....
- How do I send focus to a dynamic text ?
- How do I detect an press on Enter (or return) key in a dynamic text?
I want the press button to detect the last button pressed and if the shapes match, make them do something...obviously. I think I'm going at it the wrong way. I need to stick a "triange" id into the button/mc then if compares that and then if there is a match works then... right?
[Code]...
How can i make it so a when you press a button it starts a countdown but every other press dosent reset it?
View 14 RepliesI have a problem when I making a game Flash with action script 3,. I want tomake my character move when the key helding and I want my character attackwith one tab press either
View 3 RepliesI have text field which is 0 by default (score_txt)Two buttons +1 and -1 (plus_btn and minus_btn) When I press +1 text increases by one, and when i press -1 it decreses
View 4 Repliesi have an object that i want to drag and drop with the same event.Something like on press start drag and on press again stop drag. I'm sure it's pretty simple with and if and else statment but i can't find how to do that...The best i have done so far was this:
[Code]...
How can I use two key at a time :
I wrote this code for single key ....
Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, moving);
function moving(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.RIGHT)
[Code].....
I am making something that requires me to have a key pressed. I tried using the Code: if (Key.isDown(Key.thekey) But the key I want does not show up. I want to use the a,s,d,f,g,h,j,k,w,e,t,y,u, keys but they don't show up so I don't know how to make that happen. on a letter keypress. I also would like to know how to make it do something on the key release. I am using flash CS3 and ActionScript 2.0
View 3 RepliesI'm able to detect (at the most) two simultaneous key presses via a switch statement and series of booleans. For my game's sake, I need to be able to detect up to 4 keys.
Here's my test script:
var key_37:Boolean = false;
var key_38:Boolean = false;
var key_39:Boolean = false;
[Code]....
i have a MC with 2 MCs inside. [MC1 & MC2 for arguments sake] When MC1 is clicked i want MC 2 to go to the next frame. //code on mc1 onClipEvent(enterFrame){ on(press) { _root.MC2.nextFrame(); }} just 1 of the trial and errors ive tryed how do i do this ive tryed many different combinations and on different movie clips but nothings happening for me :S
View 7 RepliesI know how to make a button and all.. but what do I do to make it go to the next scene?
scene 1: Startsidan
scene 2: Sidan
I made a frontpage and when I click on the picture I want it to go to scene 2, where it enters the inside.
the button is called PortalenKnappen, I want to be able to just press on it and it will go to the "sidan(scene 2)" that's empty at the moment.
what would I have to write? I've tried "portalenKnappen.onPress nextScene("sidan", 1"); but it doesn't work.
I'm wondering if there's a way to temporarily disable keyboard shortcuts in Flash? The problem is that some key presses don't register when I'm testing a movie in flash because flash itself registers the key. For example pressing "B" while I'm testing a movie activates the Brush tool but doesn't trigger an event in the actual movie. When I publish the movie and try it in a browser it works fine.
[Code]...
In my game the Superhero walks around the screen by pressing some keys. But between the moment you press the key and the moment the moment the Superhero starts to move there's a slight delay.
View 5 RepliesI'm working on a project that is kind of basically a slideshow in Flash. I need to make objects appear everytime I click the Right Arrow button. So far I've made the first slide appear with this code:
Code:
object.visible = false;
//Adds event listener to the stage.[code]....
My problem is now making the others slides appear one after the other, every time I click the Right Arrow button.I think I have to do a for cycle, but I don't really understand how it works.
WHY AM I NOT OUT SNOWBOARDING?! THERE ARE 20 NEW INCHES OF POWDER ON THE MOUNTAIN! ARGH! WORK SUCKS! But to a more forum-appropriate question: I have this prototype function:
[Code]...
which works great except that it scrolls the whole thing all at once. Is it possible to put some kind of increment in there so that on a key press it only moves a certain amout of pixels?
I have 3 movie clips lined up as buttons. When you rollover one, the others fade out to an alpha of 20. I also added an arrow that is called when I click on a mc to align it self to the top center of the mc. When I added the arrow I lost my fading. Somewhere in the actions is messing this up.Here is a fla file. I am using Flash MX actionscriptI also have Flash MX 2004 but I dont like it.
View 10 RepliesI know theres a way to do this.how to press a button with AS[code]...
View 7 RepliesFor some reason I can't get it to populate my text box when I press the corresponding movieclip. Can someone take a look and help me out a bit?
View 1 RepliesI have a command inside an onpress, that doesn't do what it's supposed to.It is written like this:
Code:
on (press) {_root.window.gotoAndPlay(10);_root.imageOne.imageTween.gotoAndPlay(2);}
The above actionscript is on a button, and that button is located at:
_root.messageOne.messageGraphic
The imageTween frame 2 is the beginning of a tween that scales that movie clip, but it just sits there and doesn't scale. So the on (press) isn't working for some reason.
i have this code on a mc on stage:
ActionScript Code:
onClipEvent (enterFrame) {
if (_root.activate == 1) {
[code]....
i've done a key press and an animation leading to it... but, is there any way to limit it so dat it can be only be pressed for a given number of times...? after which when pressed, the animation will not be executed.....
View 9 RepliesHow do you press a key (like "L") and go to the next frame?
Which event must I pick?
I assume it's something like: stage.addEventListener(Keyboard., but after that I don't know what to do.
This is for AS 3.0 by the way.
I'm trying to figure out how to get buttons to be activated by keyboard presses. I have found how to do that with specific keys ... but not with ANY keypress. I'm making a game for tiny children and they can't manipulate the mouse well. So I'm setting up a few things on stage that will run in a certain order when the child presses any key on the keyboard. For example, any key is pressed, dog wags his tail .... any key is pressed again, cat jumps, any key is pressed a third time, cow munches hay, and so on till it goes through a bunch of animal animations, then goes back to the first one. I'm pretty new at this stuff and have been banging my head against google for days trying to find the answer to this out there with no luck! I could do either movieclips or movie clips inside buttons if that makes sense.
View 1 RepliesOK, say I have a button that does something, like go to the next frame, is there anyway to have it play a simple sound located in the library without looping?
View 8 Replies