A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: button press meter ?

  1. #1
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976

    button press meter ?

    I was wondering if anyone could help me in how to make button meter. What i mean buy this is where you have to press one or two buttons as quick as you can and it makes the meter go up. Like in the athletic running games and when you8 slow down the meter decreases.

    Anyone
    Last edited by hooligan2001; 12-02-2002 at 07:45 PM.

  2. #2
    .: Weirded Out :. The_Xell's Avatar
    Join Date
    Nov 2002
    Location
    Under the table and dreaming...
    Posts
    802

    Attempt

    Hey,
    Thought i would give it a shot..... no scripts just ideas

    You could have it so on the button press an MC _XScale increases. Then, inside the MC of the meter have a countdown timer that makes it go down.

    When i get back from college tomorrow i will give it a shot....

    Sorry if im talking ****, but its kinda late......

  3. #3
    Sexy beast
    Join Date
    Apr 2002
    Location
    Georgia
    Posts
    119
    Ok, make a button and a bar, on the bar movieclip, line the bottom of it up with the lil + in the middle, name the bars instance name "bar". Then on the button place this action...

    on (release) {
    _root.bar._yscale++;
    }

    I hope that helps...
    "I always board fast and do danger things. I 'keep real' so I raps for what I do in life."
    -ILL Mitch on his rap song, "Fast and Danger"

  4. #4
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976
    Thnx for that didnt use it, though it gave me an idea heres what i did

    i put this on the percentage bar

    Code:
    onClipEvent(load) {
    	keyState = "up";
    	trace(keyState);
    }
    onClipEvent(enterFrame) {
    	if(Key.isDown(Key.SPACE) and (keyState == "up")) {
    				  _height ++;
    				  keyState = "down";
    				  trace(keyState);
    				  }
    }
    onClipEvent(keyUp) {
    	keyState = "up"
    	trace(keyState);
    }

  5. #5
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976
    Ow quick question. I know their is a better way to detect if a specific key is up but i cant get it to work. The way i have it is so if any key is released it sets keyState to up, but that will stuff up what im trying to do. So the real question is how do i dectect if the SPACE key is released

  6. #6
    Senior Member mbenney's Avatar
    Join Date
    Mar 2001
    Posts
    2,744
    the easiest way to check if a key is up, is to just check if a certain key isnt down. this can easily be done with...
    Code:
    if (!Key.isDown(Key.SPACE)) {
    //space key is not pressed
    }
    maybe you could have a boolean that stores what the space key is doing...
    Code:
    onClipEvent(enterFrame){
    if (Key.isDown(Key.SPACE)) {
    spaceDwn = true;
    }
    if (!Key.isDown(Key.SPACE)) {
    spaceDwn = false;
    }
    if (spaceDwn) {
    _height++;
    }
    }
    okay... i now realise that this is a silly solution for your problem but ill leave it here anyway

    ill get back to you, i have a lesson now

  7. #7
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976
    No actually that is really useful for the project i am working on thanks heaps
    Last edited by hooligan2001; 12-05-2002 at 09:14 AM.

  8. #8
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976
    i think i worked out a good way of working my problem

    just use

    getCode();

    eg

    Code:
    onClipEvent(keyUp) {
    	a = Key.getCode();
    	trace(a);
    }
    any other suggestions are welcome =)

  9. #9

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