I was wondering about how variables would work in wick. And does it work the same in Actionscript 3.0? I used variables once in Adobe Animate but then I forgot.
You can declare a variable inside a wickObject in a few different ways
var myVariable = 'value'; // Way number 1 (only usable within your function) myOtherVariable = 'otherValue'; // Way number 2 (Usable throughout your project BUT a little dangerous)
The differences between these two are pretty subtle, but this will allow you to store values. (here’s a technical explanation you shouldn’t have to worry about unless you’re curious)
But what if I want to store a value in a wickObject so I can access it from somewhere else safely?
this.variableName = 'value'; // Way number 3
This stores the value in the object itself as a “property” so it’s accessible from other objects that are loaded within the same frame. I can access this property by saying
objectname.variableName. You can set object names from your inspector by changing it’s default name (like ‘New Clip’ or ‘New Path’) to something else!
Thanks @Luxapodular. I’m also wondering if I can access variables though “if” statements. If it’s possible, can you explain?