I have several input text boxes all of which are activated by the use of the enter key. I only want the one the user is using to run its script when they press enter instead of the keylistener on all of them picking up when enter is pressed. I have tried
ActionScript Code: listenForEnterObject = new Object(); listenForEnterObject.onKeyDown=function(){
I want to have it to that when i press up on my keyboard, my ball will jump up, and if i keep holding it down, it will not jump again until up is released and re-pressed.How my code looks right now
Code: if (Key.isDown(Key.UP)) { speedy = -30; } my ball's instance name is fivepointstar.
I'm trying to add arrow key control to my image gallery to increment and decrement the image number, but if I go to another section and go back to the gallery, the incrementing is doubled, so that I step through the images by two's. If I repeat this, it always adds 1. Here's the code I have for the Arrow keys:
so iv been using the Key.IsDown commands to change the yscale (of something), but i am at a loss at getting the yscale (of that something) back to the starting scale when the key is released.
I have a character with multiple animations by way of movieclips, and I'm trying to have it move using the Key.isDown function. Now, my character is moving correctly, but when the key is released, the animation keeps playing. I tried adding a stop command at the end of the walkcycle animation, but that just causes the character to stay frozen on the last frame of the cycle.
Here is the ActionScript Code: onClipEvent(load) { var direction = "left"; var speed = 2; } onClipEvent(enterFrame) { [Code] .....
I have a logic-sorta question about finding an alternative to an if/else statement that controls key.isDown detection.(NOTE: I am using senocular's KeyObject class, the utility found on his website senocular.com, that returns key.IsDown functionality to AS3)
typically in most game/character movement tutorials I see this:
Code: Select allif (key.isDown(Keyboard.RIGHT)) moveRight(); else if (key.isDown(Keyboard.LEFT))
[code]....
The problem im having with this code is the fact that theres an order it checks the keys due to the if/else statement.For example, if I was holding down the LEFT key and then simultaniously began holding down the RIGHT key, the RIGHT key's function would execute and override whatever the LEFT key's function was doing, since the RIGHT key is the first thing checked in the if/else statment.
The only work-around i can think of is making all the keys a single If statement, and a switch statement that controlls the movement. Which im having a lot of trouble getting to work at the moment...
I'm working on a game where movement is controlled with WASD, and other commands are controlled with YUIOHJKLNM<>. The problem I'm encountering occurs when pressing down certain combinations of three keys. For example, when I'm holding down J and M, the ASD keys won't work; only W will. The same applies to J and N, and K and <; W is the only key of the movement commands that will work.
There is nothing in my programming that I can see or find that is causing this error; I've performed several tests and managed to pretty much isolate the problem being something to do with the keycodes. Does actionscript 2.0 have some inherent issues with certain 3-key combinations being pressed?
How do I make it so that a key down function acts as a hard on/off switch, Instead of the momentary temporary toggle normally associated with "if Key.isdown"
Example: The "CONTROL" key is pressed, gotoAndPlay's an action, until the key is pressed again, which then gotoAndStop'S the action. Would I still use "if Key.isDown" or something else entirely.
I'm working on a pretty neat interactive music remixing site where you remix a song, then interact with a music video to make some cool stuff happen. I saw a few related posts on here, but I've got a bit of a more specific problem. originally I had the controls set so that whenever you click the mouse on the background (which I set as one giant blank button), that it would load a movie clip and unload the previous one:
[Code]....
This has been working fine, although now I'm trying to change the overall controls to assign every key on the keyboard to load a particular movie clip at the mouse x,y when pressed AND to unload the movie clip when it is pressed again. I think I might be applying the code to the wrong portion (in a blank frame in the timeline, not as part of any button or movie clip). I had the code setup so that I wasn't getting any errors, but nothing is happening when pressing the key. I also don't have a start on how to tell if a key has already been pressed, to perform a second action when pressed again (to unload the assigned movie clip). Here's what I've got so far:
A Flash program is connecting to WCF web service hosted on a server without anti-virus and without firewall and windows server 2003 64 bit environment.[code]...
im using this method to load movies and create transitions between them for my site.. I have read the technique thoroughly and im fairly sure the code and structure I have used is correct however the loadMovie function called from an embedded swf is not doing anything and I cant work out why..on the main timeline there is a container movie that the swf files are loaded into, the intro sequence is loaded through an action on frame 1:
this works no worries.. but when the container is targeted from inside the introsection.swf movie nothing happens, this is the code used:_root.container.loadMovie(_root.currMovie+".swf")I have tried variations with this and nothing works.. the container movie has the correct instance name and the code works from the main timeline but not from within another swf.
My flv files won't run if I move the folder where I have all the contents. How do I fix this problem so that I can run the flv's no matter where the folder is? I know this isn't exactly an actionscript problem since I imported them directly to the library and from there to the stage,
I'm building up an image resize gallery, and I want to navigate using the left and right arrow keys on my keyboard. I've been trying to figure this out a while now, but I can't get it working. Here's my code:
I have recently been working on creating a game similar to the good ol' Asteroids game. So far, I have managed to create a very simple piece of code that rotates and moves my spacecraft according to the angle it is currently at. There are two problems with it, though:
1. I can't use two buttons at once--for example, to rotate and move forward. I'm sure there must be a better way to detect key presses. What's the best way to do it in AS3? 2. The way the whole thing works looks kind of jerky and stage. Another thing is, the spacecraft is constantly at an odd angle for no apparent reason.
Here it is ("sc" is my spacecraft movieclip): var SC_speed:Number; var SC_rotation:Number; var SC_radians:Number; SC_speed = SC_rotation = 0; function keys(event:KeyboardEvent):void{ [Code] .....
I have a really strange problem. I've made a custom class that listens for keyboard events such as key presses (I use it in order to navigate in an interface). When I test my file in Flash (using 'command'+'enter') all key presses work as they should. However, when I publish the file and starts the projector (or the swf for that matter) one key ('g') isn't doing what it should!
I set up some code to record key presses and specific chords. My problem is that I only want the keys to fire once when pressed. This is especially a problem when I require the user to hold CTRL + LEFT for an action.
The user experience is that I want users to hold down CTRL to enter a mode and then press the LEFT key as many times as needed. Currently, the CTRL trace and LEFT trace fire continuously. Is there a way to do a onKeyRelease?
Code: var keyListener:Object = new Object(); keyListener.onKeyDown = function() { if (Key.isDown(Key.CONTROL)) {
When I say two keyboard presses, I'm thinking about a situation where I would need to detect both. Not a shift this or alt that or control third. I'm talking about Down + A or 5 + T. For instance: Ryu has an overhead attack that is used when both Down + MP are pressed. If I were to create a game, with ActionScript 3.0, is there a way for me to detect that both buttons were pressed at the same time?
I need to disable the keyboard after each key is pressed, so if the user presses the UP key until the character has finihsed doing the move no other key can be pressed.
I have content in a scrollpane which I would like users to be able to drag (content is larger than the pane). There are also rollover areas in the content that are only accessable when scrolldrag is false (makes sense). So, I've set the scrollpane scrolldrag property to false until the user presses the Ctrl key:
//Listener for Ctrl key to allow drag createEmptyMovieClip('_keyListener',999); Key.addListener(_keyListener); _keyListener.onKeyDown=function(){ if (Key.getCode() == 17) {