How to spawn symbols using Javascript?


(Oana Goge) #1

Short version: Can you create an instance of a symbol using Javascript?

Concrete example: Imagine you want to make a specific object sparkle by creating a symbol that takes a sparkle image from 0 alpha to full and then 0 again, and spawning several instances of that symbol randomly across the object. Sure, you could just manually create 1000 instances of that symbol, but I would much prefer if I could place some randomly with Javascript.

Thanks in advance for any ideas.


(Andrew) #2

you are unable to create elements dynamically in Hype I am afraid to say.


(Oana Goge) #3

Thanks for the reply. I was afraid that may be the case :frowning:


(Andrew) #4

In the above example, you could use a symbol, create the sparkle, and put them where you want. Then you would only need to create one symbol, and then you could use script to randomly pick which one to sparkle ?


(Oana Goge) #5

I’m thinking of just using a transparent Canvas overlay and making the sparkles on it through code, actually.