Error: win is not defined

URL of experiment:

Description of the problem: The experiment is running smoothly and without problems in the builder. But when I upload it to Pavlovia I get the error: win is not defined.
I´ve tried defining win in the builder, but that didn´t help. I dont know if I did it correctly.
I think there is a problem with the Java script, but I know nothing about code so Im lost here.

Any kind of help is appreciated. Thank you!

How are you trying to define win ?

Please have a look at my crib sheet for help

I looked at several crib sheets and tried different combinations.
At the moment I have: (in a code (js) and begin experiment)
window.thisExp = psychoJS.experiment; = psychoJS.window;
window.event = psychoJS.eventManager;
window.shuffle = util.shuffle;
win = psychoJS.window
thisExp = psychoJS.experiment

Some of those might conflict. Have you added all of them?

yes I have. but i also tried only

win = psychoJS.window
thisExp = psychoJS.experiment

and it didnt work online.

Add semi colons to the end of the lines.

Put them in Begin Experiment and nowhere else

I did that, but unfortunally it doesn´t help.

Are you using Ctrl-Shift-R to run the latest version?

Are you using win as something else (e.g. a column name in a spreadsheet)?

What do you mean by “using Ctrl-Shift-R”? (I´m sorry I don´t know anything about technology ^^)

and no, Im only using win in the custom code to change the background color during the experiment.

Why aren’t you changing the background colour via Builder Experiment Settings / Screen?

Are you using win in a Begin Experiment code component above code_JS?

I need the background color to change multiple times during the experiment (in the pauses there will be a grey background and during the trails a green one).

an no, code_JS my in the first routine. So it should be the first thing that runs.

Personally, I would use a rectangle for this.

There is a neater solution but I’m not sure it works online.