Pretty simple actually, I thought... but I cant get this to work. It is adding the event listener but not removing it on scene load. Minimal example attached. Do you guys have any idea?Event_Listener.zip (239.1 KB)
PS: I was following some of your questions on the forum in the recent days and saw that you work a lot with the window and document scope. You can do most things in the hypeDocument scope making the whole thing more "modular" and "localized".
It sure is… just query the scene name and return out of the event listener if (sceneName!='XYZ') return; if it isn't the scene you want (given you "know" sceneName on the window scope). Chris Ferdinandi has some nice reading on the general subject matter:
In contrast to his preferences I like to keep things local in Hype because I often use them as "Widgets" and can't rely on controlling window/document or might have the same widget twice on a page and want to avoid interferences.