I believe You have corrupt symbols in Scenes 2-4. Questions JHSv1.hype.zip (412.2 KB)
After a bit of initial testing in which I changed the ID for bug box in Scene 2 and nothing happened I stripped everything down to the bare minimum - removed all scenes but Scene 2 (Scene 3 & 4 had same issue as 2 but this kept it as tight as possible); removed .mp3 files and all other functions, elements & symbols but the following:
My own additions:
Trial Rect-1 - a simple Hype primitive turned to a Symbol (id “Rect-1”).
New Bug - a brand new Symbol (not duplicate or copy) into which I placed a copy of the “Bug_Box” Symbol contents. (id “Bug-new”).
I then wrote a new function (“bugTest”) for the “Button_Bug_Box” trigger:
//document.getElementById('Bug_Box').style.display = "none";
document.getElementById('Bug-new').style.display = "none";
document.getElementById('Rect-1').style.display = "none";
For this test I had all symbols set to visible - and this was the telling point…
When the (original) “Bug_Box” Symbol was commented out both the “New Bug” & “Trial Rect-1” symbols disappeared - as they should. When “Bug_Box” Symbol was included (no comment out) or ran just by itself (other symbols commented out) nothing happened - nor were there any errors in the browser console.
To confirm the “corrupt” Symbol theory I used the original posted~linked project of @Antiphones and created a new symbol (new id) in Scene 2 and the Symbol appeared as per the code.
You still have the issue of creating unique IDs or using classes, etc. Since You are already going the ID route…
One way to do this would be to give each Symbol an ID to match the Scene name, so Scene “5_q1”, “5_q2”, etc. would have the corresponding names for the “Bug_Box” symbol such as “Bug_Box-1”, “Bug_Box-2”, etc.
Then use something like this bit of code in the “Button_Bug_Box” function to determine the Scene and so establish the correct ID for the “Bug_Box” symbol.
whichScene = hypeDocument.currentSceneName(); // e.g. "5_q2"
whichScene = whichScene.slice(-1); // get the last character of the Scene name... "2"
whichScene = 'Bug_Box-' + whichScene; // which reads as "Bug_Box-2"