Description of the problem:
I want to present a grid of rock images as clickable stimuli. To do this, I created a list of ImageStims (named rock_grid) using a code component and put “rock_grid” in the field for clickable stimuli of the mouse. I can run the experiment on Python just fine but it seems to be incompatible with PsychoJS.
I got the following error:
TypeError: obj.contains is not a function
And below is the code block that causes the error:
// check if the mouse was inside our 'clickable' objects
gotValidClick = false;
for (const obj of [rock_grid]) {
if (obj.contains(learn_mouse)) {
gotValidClick = true;
learn_mouse.clicked_name.push(obj.name)
}
}
Please let me know how I can resolve this problem. I know the standard way is to list individual objects separated by comma, but in my case the list would be very long so it’d be impractical to do so.