How to restart and where to put JS functions?

… I’m in process of learning how to use different JS functions within Hype using

and got a couple of questions I haven’t found answers to in online docs:
Why when putting a js-function as ‘Run JavaScript’ action directly into Timeline or as Pointer Action,
it cannot be executed more than once at the same Timeline / Scene? Is it possible to override this restriction and ‘restart’ the js function?

Why some js-functions only work when put into ‘On Scene Load’ in the Scene inspector but they don’t work directly on a Timeline as Timeline Action? What should I be aware of to recognize it whether I can make a js-function work directly on a Timeline or not?

you should ask concrete, may be offer an example as none of your statements is true :slight_smile:

They can but really depends on what is in the JS and what it is doing.

Same answer.

Maybe post an example of what you are trying to do…

to add the restriction is NOT in any of the actions on the timelines or inspectors and how they work but likely the JS itself.

OK, thanks
@h_classen and @MarkHunte

I assumed to find a generic approach or rule of thumb for my issue(s),
but now I see they are more of a case-specific nature.

The Rule of thumb is that JS functions can be called from the Timeline or Inspector Action more than once or both.

Regardless the JS will always be called but what it does when it runs is the case-specific nature of what the JS does when it is run.

There are no restrictions in the way you originally implied., you just have code with the correct logic (and syntax) that can carry out what you intend

Hope that helps…

1 Like