ActionScript 2.0 :: [Flash8] Keylistener On Multiple Keys

May 22, 2007

I got a little problem on a simple code: There are 5 Mcs on stage named Key1 to Key5. I got a listener on keyboard that put the mc alpha to 40 if you press the key of the mc (1 - 5), and turn the alpha to 100 if key isn't pressed

Code:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(49))key1._alpha=40;

[Code]....

The problem is that it works perfectly if you press a key at time, but it don't work if you press the 5 keys simultaneously , (make strange things :'1' to '4' pressed works, but '3' to '5' make the 5th mc as un-pressed) Is there a fine way to test if the 3 simultaneous keys (char '3' to '5') are pressed ?

View 2 Replies


Similar Posts:


Flash8 :: Changing Frame With Arrow Keys?

Oct 28, 2009

Is there a way to make it so that when you press the right key your animation/game goes forward a frame and when you press the left key it goes back a frame? I have a pretty minimal knowledge of actionscript so I'm not exactly sure how it would be done.

View 2 Replies

Flash8 : Changing Frame With Arrow Keys?

Mar 12, 2010

Is there a way to make it so that when you press the right key your animation/game goes forward a frame and when you press the left key it goes back a frame? I have a pretty minimal knowledge of actionscript so I'm not exactly sure how it would be done.

View 2 Replies

SWF In PDF - KeyListener?

Oct 2, 2009

I have a SWF with a keyListener that I am using to toggle the visibility of a movie clip.This works great when I play the SWF in the FlashPlayer.exe.When the SWF is placed into a PDF, the mouse events all work great, but the keyListener no longer works

View 1 Replies

ActionScript 3.0 :: One Function For Multiple Keys?

Dec 21, 2009

I'm building a menu for a website that plays a sound each time you mouse over one of the buttons. (each button is a piano key) I've written two functions that change the size of each key on ROLL_OVER and ROLL_OUT events. What I want is someway to play a unique sound in my library for each key, without writing a separate function for each key. Either a new function, or just written into my existing ROLL_OVER function. Currently, it plays the same sound for every key.

Here is a zip of my project

[URL]

What I've got in there is a fla file called menu.fla In that file there is a movieclip on stage called "keyboardmenu" and inside that movieclip are 8 movieclip's (my buttons) each with a unique instance name. In the library there are 8 mp3 files with class name keysound1, keysound2 etc...Here is my code: ( I'm using tweener to handle the scaling. )

Code:
import caurina.transitions.Tweener;
function keyisdown(e:MouseEvent):void{
Tweener.addTween(e.currentTarget,{height:185, width:80, time:.25, transition:"easeOutBounce"});
varsound1.play();

[code]....

View 3 Replies

ActionScript 3.0 :: Cannot Get Multiple Keys To Work

Jun 21, 2010

I want to be able to toggle images on and off on key press.I cannot get multiple keys to work. I used to do this in Flash MX with the code placed on buttons off the stage. I used tell targeting with movie clips on the stage that had blank first frames and images on the second frame. Each button would call the second frame of a movie clip on keypress.Below is the code that is not working in AS3/CS4 - "M1" and "M2" are the two test movies, but only M1 works.[code]

View 1 Replies

ActionScript 2.0 :: FlipBook - KeyListener Not Going Away

Apr 12, 2011

I have a flipbook that I'm making and I'm having some problems getting rid of a certain keyListener... Here's the dealio.. This is the trouble-maker script that's on frame 3:

stop();
Key.removeListener(keyListener_n)
keyListener_np = new Object();
var repeatTest;
keyListener_np.onKeyDown = function(){
[Code] .....

View 1 Replies

ActionScript 3.0 :: Checking If One Or Multiple Keys Continuously Down

May 12, 2011

I have a character that should move using standard WASD control. I've tried to implement that using a listener for the KeyboardEvent.KEY_DOWN. However, it seems that what I get is:

1) Only one key at a time (ie I can't read both W AND A being pressed down at the same time)
2) When holding down first the events come in not every frame and later they come in every frame, ie, regularity of events relates to the system's sticky key.

What I would like is a solution where if I press the key W I continue moving to the left until the key is up. If I press multiple keys then I should move in the combined direction. What would be the best way to implement this? Do I need to listen to both KEY_DOWN and KEY_UP events and then use those as switch for movement? Is there a "good practice" way?

I got smooth movement/etc when I implemented both key_down and key_up. Essentially I made 4 booleans saying "move right/left/up/down" The boolean is set true by key_down event and false to key_up event. Movement itself is performed on enterFrame event based on how the booleans are set. Still wondering if there is a better way..

View 15 Replies

ActionScript 3.0 :: Detecting Multiple Keys Pressed Without Bugs?

Nov 1, 2010

I have it like this so far:

ActionScript Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, KeyReleased);
public function KeyPressed(event:KeyboardEvent):void

[Code]....

and so far it works good, except when I press shift. If I'm holding the left or right arrow key and then I press shift, the object stops moving and doesn't do anything. However, if I release the arrow key and THEN press and hold shift, it works perfectly. How can I make it so that I can press shift while I'm holding the arrow key and still have it work?

View 2 Replies

IDE :: Getting Responsive Keyboard Movement - Multiple Keys Pressed

Feb 16, 2010

Im having a problem getting responsive keyboard movement. I have a key_up listener which fails to trigger when 3 keys are down. E.g. Imagine up and right keys are being pressed to move up + right. The user wants to change to moving up + left. The user presses the left key before lifting thg right key. I have a key_up listener to detect when a key is no longer being pressed. However in this scenario it fails to trigger when 3 keys are pressed. Even in this online example, there is the same problem, look how unresponsive it is when chaging from up right to up left really quickly. [URL]

[Code]...

View 2 Replies

Actionscript 2.0 :: KeyListener Is Not Working At Fullscreen In Browser

Nov 20, 2009

i m just making a game for multiple questions, now i want to give some short key to select objective questions like a for 1st object nd b of 2nd object nd enter for submit . Here the sample of code which i used:-

Code: Select allvar keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {

[Code].....

Now when i use a,b,c,d keys in normal window of browser that time it's work properly but when i used fullscreen window of browser that time it's not working.

View 2 Replies

ActionScript 3.0 :: Adding KeyListener To Stage Via Object 2 Depths Below

Mar 9, 2010

I want to add a key listener to my stage, but from an object 2 depths below the stage. How would I do this? I thought about adding the listener from my doc class, but the listener function is in the object that is two depths below the stage, which would mean I would have to pass the key values to the next movie clip, then when that one is loaded, pass it to the one with the listener function. It seems very complicated, is there an easier way which keeps with the principle of OOP?

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 2.0 :: Flash8 : Search Multiple Arrays For A Value?

Feb 26, 2009

I am attempting to search multiple arrays (over 300) for a specific value which will then determine if that question is to be loaded. I have used these over the years as the quizzes simply loaded questions randomly. Now I am appempting to move this into a computer adaptive test format. I have most everything worked out except for this part which is the key to the project.

What I have is 300+ arrays like the ones below. Once a student answers a question either correctly or incorrectly a difcal value is assigned. It is that value I need to search for to determine which question to load.

For example if the student answered a question incorrectly and the difcal was calculated as -4.03 (difcal values are always in array element[0]) I would need to search the all arrays to find that value and then load that array into the question function.

Code:

var q1:Array = new Array();
q1[0] = -4.03;
q1[1] = 0.57;

[code]....

View 2 Replies

ActionScript 2.0 :: Flash8 : Preloading The Multiple Sounds?

May 14, 2009

I have 10 sound files in an array.I am wanting to preload all of them and update a counter once each one loads sucessfully.So when song 2 for instance finishes loading then the counter would be at 2,then 3,etc....I think maybe I need to use a while loop to hook each sound into a load event?

View 1 Replies

Flash8 :: Multiple Album Photo Gallery

Jul 25, 2009

Being a newbie to this flash design and actionscript and self learning with the help of forums and tutorials I have create a simple photo gallery for a website I'm building. And all works fine. What I would like to do is add a list box to display different albums but I am having trouble with the actionscript and how to set out the XML file.

[Code]...

View 1 Replies

ActionScript 2.0 :: Flash8 Affecting Multiple MCs With A For Loop?

Feb 24, 2010

Let's say I have ten widgets that have ten items that need to be turned off. What am I doing wrong here?

Code:
for(i=1;i<=10;i++){
var tempWidget = ["widget0" + i];
trace(tempWidget);
tempWidget.item._visible=false;
}

The trace returns the correct value yet the loop doesn't turn the ten items off. Why?

View 2 Replies

ActionScript 2.0 :: Flash8 - Use One HitTest For Multiple Objects?

Jul 28, 2010

I'll try to make my question pretty short and simple.

[Code]...

So what I'm trying to do is make the character stop when it runs into something. I can do that, but it will only work for one "block" movieclip I put on the stage. What can I do to make this work for multiple "blocks"?

View 2 Replies

ActionScript 2.0 :: Flash8 Multiple Variables Controlled By Key Presses

Jun 26, 2009

I am making a game using AS2, in which the user controls the character with WASD. I am making a tutorial level in which the level only advances past the first frame after the user has pressed W, A, S, and D. The level is a single frame in which there is a movieclip that has all the enemies. I made an offscreen button in the movieclip which has the code

Code:
on(keyPress "w"){
var w:Boolean = true;
}

[Code].....

When I run it, nothing happens and it stays on the first frame of the movieclip. No errors are shown in the output panel.

View 2 Replies

ActionScript 2.0 :: [Flash8] Multiple Scrollers Working On A Page

Apr 19, 2007

Has anyone found a solution to having multiple scrollers work on the same page? I tried applying different instance names on all components but that didn't work either. The AS below only allows for one scroller to work.

[Code]...

View 1 Replies

ActionScript 2.0 :: Flash8 Loading External Text With Multiple Spaces

Sep 5, 2009

I have been trying to get this working right for days and it is driving me crazy. It should be very easy, so I'm not sure what I'm missing.

I'm loading in an external text file, which is fine, but the problem is with how it is displaying.

It should look like the attached word file. But when I paste it in a text file it gets messed up. A sample of that is attached as well. I have tried making it look the same in the notepad file, but that doesn't come out right in the flash.

I have tried everything, importing as html, using xml files, copying the text into different programs and then into the text file.

View 3 Replies

ActionScript 2.0 :: Flash8 Previous Working Fla's Return Multiple Errors?

Dec 7, 2005

I've found out that when publishing with Flash 8 my previous MX's working fla files, I get multiple errors.I've had a look at the Export publishing settings and I think they're all correct: - Exporting version: 8- AS Version: 1.0So, I guess it must be a silly thing I'm doing wrong but after a long while I haven't been able to know what's wrong. Perhaps AS compatibility is not that accurate?The most common error I get is:"A ')' or ',' was expected" or"An unexpected '}' was found"(I'm using Spanish Flash 8, so I don't know if this is the exact message you're given in English Flash 8) The 'supposed to be wrong' code seems to be in lines like[AS].posicion = posicion+eval("abc" add i)+gap;abc=eval("_parent._parent.abc" add _parent.n)[/AS]and I even get a "Declaration must be inside a on/onClipEvent controller" here:[AS]._xscale=abc*1.4;[/AS] ...while ALL of this code worked perfectly in Flash MX, I get up to 104 errors in Flash 8

View 7 Replies

ActionScript 2.0 :: Flash8 - Tab Backwards Multiple Text Input Fields Instead Of Forwards

Aug 8, 2007

I have multiple text input fields (up to 40, depending on visibility)that tab backwards instead of forwards. Is there a simple solution to this mis-direction?

View 2 Replies

ActionScript 2.0 :: Flash8 - Buttons Inside Multiple Random External Swfs

May 23, 2008

detailed as possible. Took basic Flash classes, but no AS other than searching online, taking a couple Kirupa tutorials, so it's all greek tho recognizably so. I have 10 individual "scenes" currently in one swf file, but would love to break these apart individually, and load each into a "container" swf with a "random" code (so each visit to my site starts differently) which I've located and tested with Kirupa's super "Loading random movies" tutorial. Question is: currently I have active buttons in each scene which advance playhead to the next scene. How can I code these to load another swf into the main "container" file and kill/replace the current swf?

Another tutorial "Transitions between external swfs" suggests "if your buttons are not located on the main timeline, you will have to change the path to the container movieclip" - but doesn't show exactly how to do this, and I have to say I can't figure the "path" out! Another issue I foresee is that I'll need the script to automatically pull in the next swf file when the current one finishes, if the visitor doesn't click the button first... Haven't been able to find this with a few hours searching, though some threads come close.

View 1 Replies

ActionScript 2.0 :: Flash8 Dragging Multiple Movie Clips Using Begindrag Senocular Class

Feb 27, 2010

I need to have a custom mouse cursor and also have dragable object on my page. im using flash 8. I came across this site called senocular which had a list of .as files [URL]
and some simple useage such as:

on(press){
this.beginDrag(true,0,0,300,300); // constrained to 300x300 square
}
on(release, releaseOutside){
this.endDrag();
}

I would love to get this to work, however I dont know how to import this into flash 8. I thought classes only worked for flash 9 and actionscript 2.

View 1 Replies

ActionScript 2.0 :: Flash8 Fade In Fade Out Over Multiple Buttons

Apr 1, 2011

I have 4 buttons, I need each button to fade the others out as the mouseover event occurs. I can get this to work if I add in one other button to the actionscript on one, but as soon as I add actionscript for another one I get errors.

[Code].....

View 10 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







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