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

jamie bell's icon

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 Patch
Copy patch and select New From Clipboard in Max.

M.T.I.A. :)

DK's icon
Max Patch
Copy patch and select New From Clipboard in Max.

[mousestate]

jamie bell's icon

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 :)