dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: need to couple together some script

  1. #1
    Junior Member
    Join Date
    Nov 2001
    Posts
    29

    need to couple together some script

    I have a keypress that i want to perform 2 actions at same time (or as near as dammit)

    I can only get 1 to work.

    I have this:

    KeyListener = new Object();
    KeyListener.onKeyDown = function() {
    if (Key.getAscii() == 101) { // Code for e key
    mask.play();

    } else if (Key.getAscii() == 114) { // Code for r key
    mask.stop();
    }
    else if (Key.getAscii() == 116) { // Code for t key
    mask.gotoAndStop(825);



    }
    else if (Key.getAscii() == 117) { // Code for u key
    buzzer.gotoAndPlay(65);
    }
    else if (Key.getAscii() == 121) { // Code for y key
    buzzer.gotoAndPlay(2);
    }
    }
    Key.addListener(KeyListener);



    I want the part in Blue to couple together with the green and red sections dependent on keypress. So for example if the "y" key is pressed i want it to perform the green section and the blue section at the same time.



    similarly i want the "u" key to perform the red section and the blue section at the same time



    Hope this makes sense!
    Moo Power

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    ??
    Code:
    KeyListener = new Object();
    KeyListener.onKeyDown = function() {
    	if (Key.getAscii() == 101) {// Code for e key 
    		mask.play();
    	}else if (Key.getAscii() == 114) {// Code for r key 
    		mask.stop();
    	}else if (Key.getAscii() == 116) {// Code for t key 
    		mask.gotoAndStop(825);
    	}else if (Key.getAscii() == 117) {// Code for u key 
    		buzzer.gotoAndPlay(65);
    		mask.stop();
    	}else if (Key.getAscii() == 121) {// Code for y key 
    		buzzer.gotoAndPlay(2);
    		mask.stop();
    	}
    };
    Key.addListener(KeyListener);

  3. #3
    Junior Member
    Join Date
    Nov 2001
    Posts
    29
    thanks will try.
    Last edited by energetik; 07-12-2010 at 04:57 PM.
    Moo Power

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