Not able get the image component(.image) of the pieces

URL of experiment: version2_4Img [PsychoPy]

Description of the problem: This is an experiment which shows the preview of the images and then asks the participants to test by asking to solve the puzzle (which is to reorder the image grid) Later the ‘checkAnswer’ is the function which validates the answer. In my case it is always ‘Incorrect’ which is due to ‘picked’ is not able to extract the ‘.image’ but when I tried to check with ‘.name’ it is displaying correctly (img1, img2…). Not sure what went wrong. Any leads would be appreciated

This a piece of JS code:
for (let piece of pieces) {
if (piece.contains(mouse) && mouse.getPressed()[0] === 1 && newPiece === ‘undefined’) {
newPiece = piece;
newPiece.image should print ‘Images/1.jpg’ but instead it’s printing

img1 = new visual.ImageStim({
win : psychoJS.window,
name : ‘img1’, units : ‘norm’,
image : ‘Images/1.jpg’, mask : undefined,
ori : 0.0, pos : [(- 0.425), (- 0.37407407)], size : 1.0,
color : new util.Color([1, 1, 1]), opacity : undefined,
flipHoriz : false, flipVert : false,
texRes : 128.0, interpolate : true, depth : -1.0

Hi There,

Sorry I am not sure I fully understand the problem from your description could you explain the expected behaviour and what happens instead?


Thanks for the reply! There will be the preview of images at the beginning. Later the participant needs to arrange the image grid(2*2) With the correct order(attached below). If it is the correct order then it shows ‘Correct’ else ‘Incorrect’. Right now it’s always incorrect.

Aha! I think I understand now - out of interest have you taken a look at how this is achieved in the online drag and drop demo? dragAndDrop [PsychoPy]

files here: demos / Drag and drop · GitLab