If I have multiple sketches in my HTML page, what is the best way to ensure that they all load after the preload function? As of now I have three sketches. In sketch3 I have a preload function. The issue is I need to reference the canvas of sketch3 from sketch1, but since sketch1 has no preload function it is loaded before the preload of sketch3 is done, and I get undefined errors. Any help is appreciated.
Can’t you just keep checking until it’s not undefined anymore?
I was stuck on this for so long, I’m not sure how or why I missed it. Thanks so much!
Alternatively you can instantiate sketch1 inside sketch3’s setup().
You can position a sketch inside a page via a
<div> block w/ a unique id.
This way, it doesn’t matter the order you instantiate each sketch.