Call a function in permanent symbol from scene


(Léon) #1

Hi,

Is there any way to have a function in a permanent symbol that would be called on every scene load automaticaly?
Or may that could be called from the scene onLoad function ?

Thanks a lot,


(Hans-Gerd Claßen) #2

you can run a function on sceneload and that function may invoke sthg. in your persistant symbol … yes


(Jonathan Deutsch) #3

In the Head HTML you can setup a javascript handler for the HypeSceneLoad event:

<script>
	function hypeSceneLoadCallback(hypeDocument, element, event) {
		// do something here...
	}

	if("HYPE_eventListeners" in window === false) {
		window.HYPE_eventListeners = Array();
	}
	window.HYPE_eventListeners.push({"type":"HypeSceneLoad", "callback":hypeSceneLoadCallback});

This will get called on every scene load.


(Léon) #4

Thanks for your help,

@h_classen, I’d prefer not to add a new function on every scene,
so @jonathan’s tip sounds better for me.

Thanks a lot.