I have two scenes in my project (Scene 1 and Scene 2) and Scene 1 includes a persistent symbol only added to that scene. I can start the symbols’s timeline with this script triggered from within the same scene:
You actually cannot because the Hype runtime (re)moves the symbol from the scene and invalidates the access or rather the command hypeDocument.getSymbolInstanceById only return symbols on the current scene. Additionally, behind the scenes (in the HTML) if you inspect it: The persistent symbols HTML is moved (detached and reattached) into an invisible DIV node.
You can check by logging in your Button function: console.log(hypeDocument.getSymbolInstanceById('Progress'));
BTW You can always store information in a centralized fashion and run symbols from that central data store (like hypeDocument.customData). The reactive movement uses this approach and trickles down information from a data store to all components on the render tree. The basic premise being that its one way much like in CSS (Cascading Style Sheets) don’t allow parent sectors.
Interesting use case! I can’t recall our reason for not allowing a persistent symbol to be looked up in this manner, especially when we’ll keep running its timelines in the background.
Another workaround would be to use a custom behavior. You could add one inside the persistent symbol (I call it “starter”) that starts the main timeline. Then you can either use the Trigger Custom Behavior… action or the hypeDocument.triggerCustomBehaviorNamed('starter'); API.
Thanks for the detailed explanation Max. I’m working on a project that has the overview of all scenes in the first scene and need some kind of progress tracking to be displayed in the first scene based on various user actions in other scenes. I will look into your HypeSymbol Cache as I wast to learn more stuff you can do with Hype.