How to access to a variable from another Scene

Hi !
I would like to use a value computed in another Scene : how could I access to it ?

Thank you for your help !-)

Generally you need something with a greater scope than the scene/function you are operating on. You could use a global, specifically just by accessing the window object and assigning items. However this may lead to conflicts if some other script wants to write to the same names.

The Hype API has a customData object field tied to the document that is intended for your own private storage for variables related to the documents as a whole.

To set a value:

hypeDocument.customData.myValue = 10;

where myValue is your own variable name and 10 is your computed value.

To get a value:

var something = hypeDocument.customData.myValue;
alert(something); // do something with the value
1 Like

Thank you very much for this help : I was unaware of this field !
This will help me a lot

1 Like