A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Multimedia devloper
    Join Date
    Oct 2001
    Location
    jordan-amman
    Posts
    80
    hi... Ihope u can help me with this problem!!!


    I have written a script that will detect if a certain key is pressed using (if.isdown(anykey))
    my problem is that this script can only detect a single key press,
    i want it to be able detect a two key press like (shift+anykey)

    is it possible ????i'v tried every thing a could but no use..please help..thx anyway!!

  2. #2
    OG Irfaan.com's Avatar
    Join Date
    Jan 2001
    Location
    Canada
    Posts
    162

    Post use actions!

    - Posting from the mall -


    << ^^ - Therefore, my description will be detailed when I get to my desktop.

    _____>>


    Just use actions my friend!

    All you have to do is get into your frame actions, and select: "when key pressed"... this will write the action script for you.. saving u the hasstle of playing with your own written actions.

    I'll get backto you with details when i get to my desktop!

    Irfaan

  3. #3
    Senior Member
    Join Date
    Jun 2001
    Posts
    280
    According to the Flash 5 Bible, "Multiple key combinations are not supported.This rules out diagonals as two-key combinations in the classic four-key game control setup. It also means shortcuts such as Ctrl-S are not available."

    Cheers,
    Bryan T

  4. #4
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Originally posted by BrainTea
    According to the Flash 5 Bible, "Multiple key combinations are not supported.This rules out diagonals as two-key combinations in the classic four-key game control setup. It also means shortcuts such as Ctrl-S are not available."

    Cheers,
    Bryan T
    I have a .fla right here right now that allows you to control a simple dot around the screen with 1 key (left right up down) or 2 keys (up+right up+left down+right down+left) to make it go on a diagonal.

    Here, check out the .swf for yourself. http://www27.brinkster.com/nerdinside/keyisdown.swf (click on the .swf before you hit a key. use the arrow keys.
    [Edited by NerdInside on 01-06-2002 at 02:21 AM]

  5. #5
    OG Irfaan.com's Avatar
    Join Date
    Jan 2001
    Location
    Canada
    Posts
    162

    Exclamation care to elaborate??

    NerdInside -

    Would you care to go one step further to help -amjad_ghost- by explaining the process one would use to accomplish this task, or just paste your script?? Thx.

    Irfaan

    (Nice example)

  6. #6
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    You just wanna know dont ya? I am gonna try to make it work with Shift+A to then goto a frame, if I get it to work I will post it.

  7. #7
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Ok, this was quick.

    Add this to a MC that is outside the frame (so you cant see it):
    Code:
    onClipEvent (enterFrame) {
    	if (Key.isDown(Key.SHIFT)) {
    		if (Key.isDown(Key.SPACE)) {
    			_root.gotoAndPlay (2);
    		}
    	}
    }
    Then, when the user hits SHIFT and then SPACE they will go to frame 2.

    The one used on that sample is this:
    Code:
    onClipEvent(enterFrame) {
    	if (Key.isDown(Key.RIGHT)) {
    		_root.circle._x++;
    	}
    
    	if (Key.isDown(Key.LEFT)) {
    		_root.circle._x--;
    	}
    
    	if (Key.isDown(Key.UP)) {
    		_root.circle._y--;
    	}
    
    	if (Key.isDown(Key.DOWN)) {
    		_root.circle._y++;
    	}
    }
    Add that to a MC that is outside the frame. Give what you want to move th instance of circle.

  8. #8
    Senior Member
    Join Date
    Jun 2000
    Location
    Sydney
    Posts
    158
    howdy,

    just use two separate movie clips with 'on clip event' handlers. 1 clip has the first 'key.isDown' and the other is on the second clip and detects the second key. Works for me.

    cheers
    Pixel Boy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts




Click Here to Expand Forum to Full Width


HTML5 Development Center