Global variables and more

  1. Global variables
  2. OnDoubleClick
  3. OnKeyUp/Down
  4. OnScroll
  5. Scroll to
  6. Paste as vectors

If you, of course, intend this to be also a UI prototyping tool…

Thanks for the suggestions!

In the scene inspector we do have OnKeyUp/Down actions. You can also create global variables using standard javascript by doing things like:

window.myAwesomeGlobalState = 5;

Thanks, Stephen!

I did find KeyUp and KeyDown.

Global variables (excuse my total JS ignorance): if I specify it in one javascript, will it propagate to others? How about using Persistent Symbols’ values for that? One can put them outside the canvas for example.

Any javascript that shares the same window object will have access to the variable (this generally means anything in the same page that isn't in an iframe).

Persistent symbols are a nice way to share state between scenes, but not across documents.

Thanks! Both approaches worked, i.e. I’ve loaded globals on Scene Load, but then I have to specify them as “var myVar1 = window.myGlobal” in every inside script. Persistent symbols’ values worked too. It’s a good way, if you want to keep project globals “visible”.

Of course, they wouldn’t work across documents. For that you’ll need to implement such thing as “project” (as Flash did at the end, but it didn’t save it…).

2 Likes