Preload fails for path specified in call function #1793
-
Hi, in my experiment I'm trying to preload an image which is set from a call function. var stimulus = '';
var setstimulus = {
type: 'call-function',
func: function(){stimulus = 'image.png';}
};
var preload_trial = {
type: 'preload',
images: [stimulus],
show_progress_bar: false,
show_detailed_errors: true,
on_start: function(){console.log(stimulus);}
};
jsPsych.init({
timeline: [setstimulus, preload_trial]
}); Is this issue known with call functions? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @GAldegheri At the time that To use that updated value for |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply, it works! |
Beta Was this translation helpful? Give feedback.
Hi @GAldegheri
At the time that
preload_trial
is declaredstimulus
is still''
. Thecall-function
trial doesn't run until after the experiment is initialized, at which point the value ofstimulus
is updated.To use that updated value for
preload_trial
, you need to use dynamic parameters.