Problem with external JavaScript

In order to facilitate future updates of my application, I’ve put the big functions into an external script. However, I find that the externally-loaded js chokes on references to the Resource Library. More specifically, I get a “Failed to load resource” error (404) when the statement referring to an image in the Resource Library is executed.
I attach a very simple demonstration of the problem.
Any ideas why this won’t execute?
Thanks.

Here’s the file.ExtFileProblem.hype.zip (76.7 KB)

Give this a shot instead:

theBox.style.backgroundImage = "url('"+hypeDocument.resourcesFolderURL()+"/" + imageName + "')";

Excellent. Thanks very much for your suggestion, which works fine.
I guess the code I had worked when embedded within the app because the hypeDocument was the default there.