Help on how to use both the mouse down and up click on a button, please?

    MaxMSPbeginner

    jamie bell's icon
    jamie bell's icon
    jamie bell
    Mar 30 2016 | 3:07 pm
    I feel silly asking this but I need to use a button for activating a maths function for the duration that it is pressed and when it is released then set the values to 0 .
    I have tried various different ways of trying to use the mouse down & up click already but the main problems are;
    1 - [button] only responds/sends out a bang when pressed 2 - [button] does not send an integer 3 - [toggle] needs to be pressed twice to output a value of 0.
    I've included a simple patch and my aim is to have the corresponding value in one of the [flonum] boxes, but only whilst the button is pressed.
    Max Patcher
    In Max, select New From Clipboard.
    Show Text
    M.T.I.A. :)

    • DK's icon
      DK's icon
      DK
      Mar 30 2016 | 3:54 pm
      Max Patcher
      In Max, select New From Clipboard.
      [mousestate]
      Share
    • jamie bell's icon
      jamie bell's icon
      jamie bell
      Mar 31 2016 | 9:38 am
      HI DK thank you for the patch and reminding me of [mousestate]. I didn't use [mousestate] in the end because I didn't want the extra clock-cycles from polling, however it reminded me that [waveform~] has a mouse state output so I shrunk down a [waveform~] to the size of a button and it works a treat :) Thanks again, very much appreciated :)