A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: multi keypress' ??

  1. #1
    Member
    Join Date
    May 2001
    Location
    Cairo, Egypt
    Posts
    32

    multi keypress' ??

    I am trying to make a file that the user can press different keys and get different colour background.
    So far i have managed to do single letter keypress' i.e. press n to get a light blue background and b for a black background.

    But i would like to change the n to the letter bl for (blue) so when the user holds down keys b+l they would get that color.

    Is it possible to have two keys to press in a keypress?

    This is what i have entered into my movie clip so far.

    on (keyPress "n") {
    changeColor = new Color("change");
    changeColor.setRGB( 0x0066FF);
    }
    on (keyPress "b") {
    changeColor = new Color("change");
    changeColor.setRGB( 0x000000);
    }

    thanks for any help
    dan r
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112
    this will call the trace function only if both the specified keys are down

    Code:
    myListener = new Object();
    myListener.onKeyDown = function() {
    	if (Key.isDown(Key.CONTROL) && Key.isDown(Key.SPACE)){
    		trace("WORD!");
    	}
    };
    Key.addListener(myListener);
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

  3. #3
    Member
    Join Date
    May 2001
    Location
    Cairo, Egypt
    Posts
    32

    cheers

    yeah thanks thats helpful

    cheers
    dan

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