Label based on variable

I would like it so on one scene the user can click a button that will bring up a pop up or something to set a variable and then I can have multiple scenes with labels that show that variable.

Hi Zach, this might get you started…

var myVar = prompt("Enter a Variable", "");
console.log (myVar)	

Also, try searching the Forum for Global Variable

Just put your var in the window context

window.myVar = prompt("Enter a Variable", "");

To reuse it later just get an named element by ID and replace innerHTML
(Naming is done under ID_Information-> Unique Element ID)

var elm = hypeDocument.getElementById( 'your_id_name_goes_here' );
elm.innerHTML = window.myVar;

Change VAR- and ID-names to suit your needs and naming preferences.

There are no security mechanisms in place but for simple purposes without storing this for other users you should be fine. But to be save I recommend reading up on:

Enjoy.

1 Like