Apparently I was this many years old when I learned unique ID's aren't preserved between different layouts.
It's normally not an issue except when targeting elements using document.querySelector instead of hypeDocument.getSymbolInstanceById, I lose various Hype capabilities like instance.goToTimeInTimelineNamed, etc.
Is there a workaround for this?
Use the built in
hypeDocument.getElementById to target the same id across layouts. Under the hud Hype renames your IDs to make them truly unique (as demanded by the specs and name) and keeps track of that changes with an internal lookup. That is why you
hypeDocument.getElementById exists and you use over the regular
If you want to target using
querySelector please use class names as Hype leaves them alone! I personally prefer the later as it’s more powerful and I don’t need to expect interference from Hype or ID collisions with duplicate Hype widget or other scenes/layouts.
PS: when using querySelector try limiting your queries to the current scene. Read more about that here:
Using querySelector instead of getElementById