Accessing images through Javascript

Nov 05, 2020

I need to create a memory game that is re-playable. So I've been playing with creating it in Javascript.

From the best practices guide, I found:
parent.document.body.style.backgroundImage = "url('images/image.png')";

Anyone know how to add images to the stage in the same way? parent.document.stage...?

3 Replies
Math Notermans

Its not that simple as your code. But it is possible.
Check my test on Review....
Adding images

So what is needed ?

First you add your images to the Resources.
Then you can call them with Javascript.

The sample shown adds a DIV to the Storyline player and then adds the images in the external content folder to it. Offcourse you can also use external https urls.

Working sample attached. As said it aint simple but gladly help.
You also need the folder attached available to the WebObject on the slide with the resources.
Several of my generic Javascript code inthere. You probably do not need it all, but its in my standard setup...

This discussion is closed. You can start a new discussion or contact Articulate Support.