| Reference | Downloads | Github

ReferenceError: frameDur is not defined for online study containing movies

URL of experiment: Pavlovia

Description of the problem:
Hi I came across a problem when trying to pilot my study. I got the following error “ReferenceError: frameDur is not defined”, and it asked me to contact the designer. Do you know how to solve this? Thank you so much.

In javascript, variables need to be declared before they are given a value. That is, you can’t simply write, “frameDur = x”; rather, you need to first have a line somewhere stating “var frameDur;” (or “var frameDur = x”). Looking at your code, I see that frameDur isn’t declared anywhere, so that’s why you’re getting the error. If you’ve generated your study in Builder this is surprising, because usually it puts this all automatically in the code. If you’ve been editing the code manually though, you just need to declare frameDur before you refer to it.

1 Like

@emmafang, this usually means that there has been a compile error in your code. The frameDur variable should be declared automatically, but this will not happen if something went wrong, e.g., you have a syntax error in your code components.

BTW, the latest version of PsychoPy should make compile errors more visible

Thanks @ps2, the code is generated by Builder. I tried to add “var frameDur;” but it does work.

Thanks @dvbridges, I downloaded the most recent version of Psychopy (Psychopy 2020.1.1). I don’t have that problem anymore. However, I have a new problem now. I can’t see my stimuli (i.e., short clips) and rating scales. The new link to this study is