ActionScript 3.0 :: GetCharCode And Non-character Keys?

Jul 20, 2009

String.fromCharCode works for converting the keycodes into the character on the keyboard that they represent, but it does not work with all the keys.

If the keys I am using are A,B,C,D,etc this function works, but if they are Keyboard.LEFT, Keyboard.ENTER, Keyboard.SHIFT, etc, fromCharCode doesnt return anything with these key codes.[URL]apparently shows that these keys (like SHIFT, ENTER) have no char code, just a key code.There must be some way to convert these non-character key codes into strings that say what the key was, right?

View 2 Replies


Similar Posts:


Moving Character On X (left And Right) Only With Arrow Keys?

Aug 17, 2009

i got my character to move left, right, down and up wit this code:

[Code]....

My question is, how can i block the up and down movement? I tried simply deleting some part of the script to block does movement from the user. But then the script would not work properly : s Here is the uploaded page i'm working on: link.

View 2 Replies

ActionScript 2.0 :: Character Walking With Keys And By Mouse?

Sep 23, 2010

Wanting to be able to move multiple characters around a map (one at a time)First selecting them either by keyboard shortcut of by clicking them.then being able to move them with WASD of by clicking the mouse to a certain position on the map and the character would move in that direction.

View 1 Replies

ActionScript 3.0 :: Character Won't Move With Arrow Keys In It

Jun 8, 2010

My character's name is character. When left and right are pressed it tells me what's being pressed when I run it - it says there's no errors with the code. My character doesn't do anything though! [code]...

View 5 Replies

ActionScript 3.0 :: Dictionary With String Keys: Slower Than Object Keys?

Apr 27, 2011

whether using a String as the key in a Dictionary results in slower lookups than using an Object, Class or Custom Object (an instance of developer defined Type)?

When using a String as a key, does the literal String have to be parsed, or does the Dictionary key point to the String Object?

View 2 Replies

ActionScript 2.0 :: Get The AWSD Keys To Work As Smoothly As The Arrow Keys?

May 16, 2003

How do I get the AWSD keys to work as smoothly as the arrow keys. I can put the arrow keys inside an enterFrame

[AS]onClipEvent (enterFrame) {
//move the tank
if (Key.isDown(Key.RIGHT)) {

[Code]....

If I put the AWD keys inside an enterFrame they run until I push another button

View 6 Replies

ActionScript 3.0 :: Character Animation - When I Press Left Or Right Key - Draw Each Frame That Makes Character Movement?

Sep 24, 2010

I have a 9 frames image of a character.In other language generally i used to make character animation by looping the array consisting of different frames and drawing each frame when pressing key.What i want to do is when i press left or right key, i want to draw each frame that makes character movement and update x coordinates of frames, and it will appear as character is moving.

View 4 Replies

ActionScript 3.0 :: Regular Expression To Test If A Single String Character Has Both Upper And Lower Case Character?

Nov 27, 2010

Does anyone know the regular expression to test if a single string character has both upper and lower case character?

eg. All A-Z and a-z.

View 0 Replies

ActionScript 2.0 :: Make A Movieclip Of A Character And When The Character Is Dragg?

Aug 11, 2009

i was wondering if any of you out there could tell me how it is possible to make a movieclip of a character and when the character is dragged about the screen by the curser, how do you make the characters arms and legs swing about in a realistic fashion.

View 2 Replies

ActionScript 2.0 :: Drunk Moving Character To Be Able To Catch Character And Play A Scene From Within The Drunk Characters Movie Clip

Jan 13, 2004

I would like my character to move as if he was drunk I am unsure how to do that I am using the keyboard for his movement. I also have a character that moves at random I would like the drunk moving character to be able to catch this character and play a scene from within the drunk characters movie clip but I want this character to try and escape the idea is the drunk character gets points for how long he is able to hang on to this character

View 2 Replies

ActionScript 3.0 :: 2 Keys At Once

Oct 15, 2010

My code doesnt detect 2 kest at once.I want to press an arrow key and spce bar. In .net the below code does do this but in flash if I hold down an arrow key and press space bar the arrow key event will stop working.[code]

View 7 Replies

Using Keys To Control A Timeline

Jan 18, 2010

in AS2 how would i use the down arrow key to make the timeline play? at the moment i have this and i presume i need to put something after that to make it play. [code]but i presume this is totaly wrong because the "stop();" doesnt stop the clip when the "if (Key.isDown(40))" bit is after it.

View 2 Replies

ActionScript 3.0 :: Way To Trap All Keys

Mar 7, 2010

I have a quiz projector file in full screen. I want to prevent students from using keyboard shortcuts like alt+tab or the win key.[code]...

View 1 Replies

ActionScript 3.0 :: Check If No Keys Are Down?

Mar 23, 2012

How do I check wheter KEY_DOWN is false on every key on the keyboard? (no keys are pressed)

View 3 Replies

Set The State Of Keys Rather Than Just Read Them?

May 9, 2009

is it possible to set the state of keys rather than just read them in AS3? I am particularly interested in setting the state of the CAPS LOCK, NUMBER LOCK and SCROLL LOCK if possible i.e. toggling the LED state.

View 2 Replies

ActionScript 3.0 :: Reading All The Keys?

May 28, 2009

using the authoring tool to test,I find I can only read certain keys via:stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
 
But when I test in a browser, I can indeed read all the keys. So the IDE must be intercepting certain keypresses. E.g., I can read w and d but not e.

How can I read all keys? Testing in a browser all the time is a bit inconvenient

View 1 Replies

ActionScript 1/2 :: Get The Fox - By Using The Arrow Keys?

Jul 14, 2009

The objective is to get the fox - by using the arrow keys - to move around on the stage and when he touches a duck the duck should disappear of the stage. The duck has a motion tween on it, to make it fly.Also if the fox touches one of the traps he should make a sound - using the redfox.wav sound  in the library and disappear off the stage.I have this code on the actionscript timeline //Program to generate a set number of traps

//Declaring Variables var numOfTraps:Number; var movieWidth:Number; var movieHeight:Number; var counter:Number; //setting variables values for traps numOfTraps = 6 movieWidth = Stage.width; movieHeight = Stage.height; //Program to generate a set number of traps //Declaring Variables     for (counter = 7; counter <= 13; counter++){ //Place 6 traps on the stage [code]....

View 11 Replies

Use Keys To Activate Buttons/

Jun 24, 2010

I have done up a flash demo which uses the computer mouse to navigate. Now instead of using mouse, I want to use keyboard (arrow up, down, left, right) to highlight buttons and then hit "enter" key to click the button.

View 2 Replies

ActionScript 3.0 :: Key Presses - But Only For Some Keys

Dec 9, 2010

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!

View 2 Replies

ActionScript 2.0 :: Can Two Keys Be Registered At Once

Mar 6, 2007

Is there any way to set an event if two keys are down at once in actionscript? For example:

onClipEvent(enterFrame)
{
if(Key.isDown(Key.UP))

[code].....

View 2 Replies

ActionScript 3.0 :: Using Keys To Move MC?

Oct 8, 2009

I'm learning Flash and Actionscript and playing around with some different features. I have an MC of a car and have coded them arrow keys to move it left and right and the up and down keys to adjust the speed. It also flips the MC horizontally based on which direction is pressed. There is a startover button that goes to the beginning of the timeline, and a back and next button.

Everything works except I have to click on the stage to get it to recognize the key presses. Once I click the stage it works fine. If I go forward and come back it won't work until I click the stage again. I THINK it was working correctly last night, but I was playing around with some of the images and code this morning and realized it wasn't working right anymore...or maybe I just didn't realize I was clicking the stage last night.

Here's my script:

Code:
stop();
btnStartOver.addEventListener(MouseEvent.CLICK, StartOver97);
function StartOver97(event:MouseEvent):void {

[Code]....

View 5 Replies

ActionScript 3.0 :: Not All Keys Are Registering?

Nov 10, 2009

I am trying to get a keyboard input why my game is playing. So here is my code below. Thing is, only certain keys are coming up in the trace. So if I press the a key, nothing happens. If press the d key, I get the trace. Only a handful of the keys are registering... why?

Code:

function PowerUps(e:KeyboardEvent):void{
var holdout = getTimer();
var theKey:String = String.fromCharCode(e.charCode); //the key code the was pressed

[code]....

View 5 Replies

IDE :: Disable Up/down Keys In A Combobox?

Jan 6, 2010

I'm building a simple app where an image displayed changes based on which image is selected in the combobox. Pick a different image in the combobox, the old one transitions out, the new one transitions in. Easy, right? So while the transition is taking place, even though I disable the combobox (.enabled = false, and I remove the Event.CHANGE listener for the combobox, I can still scroll through the combobox's options with the up/down arrow keys. I'd like to lock that ability out temporarily

View 1 Replies

ActionScript 3.0 :: How To Get All Keys Of A Dictionary

Dec 23, 2010

in Java this: dict.keySet()

View 6 Replies

MC Move With Arrow Keys Within Boundry

Mar 31, 2010

I have a file set up with a movie clip moving from side to side by itself and when it reaches the end of the stage it goes back in the opposite direction.[code]I know want to control the movie clips movement with arrow keys, just left and right so that it would stop when it reaches the edge and will only let me move it the opposite direction.I guess I'm just trying to set up a sort of template.

View 9 Replies

Changing The Value Of A Variable By Pressing Keys?

Jun 18, 2010

There is probably a better way to do what I'm trying to do, but I simply want to make a variable change its value when I press the arrows keys. For example if I wanted to cycle through weapons, if weapon=0 then the character is holding a certain weapon, then I press the down arrow key and weapon=1 and if weapon=1 the character is holding another weapon. And if I press up weapon=0 again so he's holding the first weapon again. And say there's 8 weapons, if weapon>8 then weapon=0 again so its a cycle. I tried arrow key functions and all they worked for was making a symbol move. I think I knew how to do this stuff in gamemker pretty well but Flash is very different.

View 2 Replies

Arrow Keys Goto Next Frame

Apr 29, 2011

I have been using powerpoint all long for my presentations, but I'd like to move on with Flash. My question is therefore as follows: How do I use the arrow keys to go to the next frame and optionally, the left key to go to the previous frame?

View 2 Replies

Components: Combo Box / Set Of Keys As Will Not Affect

Jun 28, 2011

I have been making a game and have recently found out about the Combo Box component, I love it and it works really well, except for one thing.You play the game using the arrow keys, and when you press the arrow keys the character moves, AND it changes the value in the Combo Box, I do not want it to affect the combo box.Please do not say use the WASD keys or another set of keys as this will not affect it, because this is not an option, they are already being used!

View 9 Replies

ActionScript 2.0 :: Key Listener Works Only On Keys W, U, D, G And X

Dec 17, 2011

Key Listener I did on Flasg-8 stopped working properly after I re-published them in Flash CS3 In particular reloading the clip on pressing A still does not work, although it used to on Flash-8. The relevant bit of code is:

switch(Key.getCode())
{
case(65)://a
trace(Key.getCode());

[Code].....

variable game_swf is defined earlier and is simply a name of this clip: "game1.swf" and on pressing A it traces correctly

The fla file is saved as FLASH8 The publishing settings are AS2, Flash Player 9

The whole thing is running on PC with Windows XP

View 2 Replies

ActionScript 3.0 :: Assign Sound To Keys?

Feb 16, 2012

Iv created a virtual keyboard in flash using arrays and buttons i now want to assign a sound to all keys so that whenever they are pressed the sound will play, I'm guessing ill need to use a for loop or something but i really don't know how i would go around doing so.

View 2 Replies







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