A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Testing if mousebutton is pressed

  1. #1
    Junior Member
    Join Date
    Dec 2000
    Posts
    3

    resolved

    Hey lads.

    Is there any way to check if the mousebutton is pressed in actioncsript?

    I have an "endless" loop that needs to break if the mousebutton is not pressed. on(release) does not work since
    the script gets "stuck" in the loop.

    Thanks.

  2. #2
    Senior Member
    Join Date
    Oct 2000
    Posts
    144

    Cow Icon yes

    make it into a variable like in the button

    onMouseEvent(release)
    press=true;

    then elsewhere place an if statement

    If(press=true)
    do this


    I don't understand the part about on release interupting your clip. remember this set variable does nothing unless you do something with it. It could be the second action on your button the first being a go to or something else.

  3. #3
    if the btn really doesn't get the event, use "onClipEvent" handler.
    make a null movie to watch the release of mouse button.

    onClipEvent (mouseUp) {
    your_acton_here();
    }

    BTW, did you try on(release,releaseOutside) ?

  4. #4
    Junior Member
    Join Date
    Dec 2000
    Posts
    3
    that might work, thanks

  5. #5
    Junior Member
    Join Date
    Dec 2000
    Posts
    3
    BTW Gentlemen, here is the code, so you can see what I'm getting at:

    on (press) {
    b2m = new sound();
    b2m.attachsound("b2m");
    xPos = (getProperty(bg_knapp, _xmouse));
    yPos = (getProperty(bg_knapp, _ymouse));
    xPos = (xPos)/(4);
    yPos = (yPos)/(4);
    xPos = int(xPos);
    set (yPos, int(yPos));
    this.b2m.start(xPos, 3);
    // ___TIME STUFF____
    sSecs = (getTimer());
    eSecs = (getTimer()+1000);
    while (true) {
    if (sSecs>eSecs) {
    trace (getTimer());
    trace ("done!");
    this.b2m.stop("b2M");
    trace ("stopped");
    this.b2m.start(xPos, 3);
    trace ("starting again");
    eSecs = (getTimer()+1000);
    // how do i check if the mousebutton is NOT pressed?
    // I need to break here, 'cause on(release) is NOT fiering.







    continue;
    }
    sSecs = (getTimer());
    trace ("waiting...");
    }
    }
    on (release) {
    this.b2m.stop("b2m");
    trace ("released");
    mouseUp = true;
    }
    [Edited by feelo on 12-11-2000 at 07:34 AM]

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