Forum Discussion
Tim_
6 months agoCommunity Member
Change state of button from Javascript?
Is it possible to change the state of a button to 'visited' or 'hidden' from Javascript (e.g. execute javascript when timeline starts on this slide).
Or do I need to set a variable for each object...
Tim_
6 months agoCommunity Member
Yeah so far the only way I've got is to make a variable and use Player.SetVar() from javascript, and put a trigger in (change state of .. set state to .. when variable changes). I can kind of "bus" the variables to multiple states by using an if condition to check for specific values in the variable, but i was really hoping to be able to grab a reference to the object, e.g. setting an object identifier, which I can set through the accessibility option, then refer to from javascripting using document.querySelector("[data-acc-text='my-object-id']"); ... but there aren't any methods that I can find that tell the object to change its state directly.
I'll consider the answer to my own question as "No, set and watch Variables".