psychopy.org | Reference | Downloads | Github

Mouse issue: event.Mouse is not a constructor

URL of experiment: Pavlovia

Description of the problem:

Hi!

I’m getting this error message:

The mouse is only defined once in a code component at the very beginning of the experiment:
Screenshot 2020-07-15 at 11.04.07

I can’t find any reference to event.Mouse() anywhere in any other code components.

How can I fix this?

Why are you defining the mouse in JS code only?

I normally create one mouse component (called mouse) in the first routine that needs it and then refer back to the mouse (no new mouse components) for the rest of the experiment.

Hi @wakecarter! Thank you for your reply!

I have two mouse components. One in the trial routine and one in the response routine (I’ve called it feedback routine).

I put the above code into a code component within my very first routine of the experiment (instructions routine) because I thought it would help with converting everything to JS.

After that, the only time the mouse is mentioned in a code component is when I’m checking for responses during the trial, i.e.:

if mouse.getPressed()[0]==1:

Thank you for your help!