Create Sprite From File And Set Its Screen X,Y From Within JavaScript?

Hi,

I would like to create a sprite from a file and set its screen x,y from within JavaScript.

The sprite file is in the follow path of the the project’s folder:
“\assets\images\BG_Black.png”

If someone could post some JavaScript code here that does the above it would be greatly appreciate, thank you!

SS

Hi,

Below works:

const obj = runtimeScene.createObject("NewSprite"); // NewSprite added to Scene
obj.setPosition(100, 100);

Below does not work?:

const obj = runtimeScene.createObject("\assets\images\BG_Black.png");
obj.setPosition(100, 100);

Is it possible to load dynamically files in the projects folder from a JavaScript file?

SS