Can't access child Clip's variables (1.0.9)

I have a frame script in my Clip “Puzzle” that defines some variables:

this.question = "What are all these emoji describing?";
this.correctAnswers = ["watermelon"];
this.incorrectAnswers = ["recycling", "greenness", "tree", "sync", "syncing", "bush"];

But when I try to access them on the main timeline (in a frame script)…
var answer = Puzzle.correctAnswers[random.integer(0, Puzzle.correctAnswers.length-1)];

…I get an error:
Puzzle.correctAnswers is undefined

I thought maybe it was because the frame script accessing Puzzle.correctAnswers was being run before Puzzle’s code, so I moved the frame script to the following frame. This didn’t help.
I also put that script in Load instead of Default, but that didn’t help either.
I also tried declaring Puzzle’s variables with var, but that had the same result.

How can I safely access a child Clip’s variables from the main timeline?

Example file: Emoji_BugReport.wick (97.2 KB)

Just pushed a minor version update that fixes this. The problem is that this on Frame scripts was referring to the Wick.Frame object, when it should refer to the Wick.Clip that it belongs to (so it works more like Flash)

Will make an update thread for 1.0.10 soon~

2 Likes

Thanks! Unfortunately, the issue still happens on 1.0.10 with the same file. I tried doing a hard refresh (Ctrl-Shift-R) but it didn’t help.
Here’s another example file:
Scope2_BugReport.wick (1.4 KB)

Oh whoops, I thought I had fixed it but the test I wrote was bogus D:

I found the issue though, and will push a hotfix soon!

2 Likes

Yay, it works now! :smile:
I ran into another nasty bug, though. If I declare a function on frame 1 of the root timeline and then try to call it in frame 2, it is undefined. Declaring the function in the default tab of frame 2 and then calling it in the load tab of frame 2 also doesn’t work.
Scope3_BugReport.wick (1.2 KB)
Scope4_BugReport.wick (1.7 KB)
Edit: Fixed Scope3 example and added Scope4 to show that the bug also happens inside clips.

1 Like