Sometimes, after I restart Wick (either by doing a hard refresh, reopening the same document, or restarting my browser), I get an error that I didn’t get the last time I ran the project. In this case, I got Menu.animation is not defined.
Menu is a clip with multiple frames, and only one of them, correct, has a Clip on it called animation. I think what happened was…
- While testing my project, I opened the frame of
Menuthat containedanimation. This is because I had some code that ranMenu.gotoAndStop("correct");This set the value ofMenu.animation. - I added some code directed at
animation.
Menu.gotoAndStop("correct");
Menu.animation.gotoAndPlay(0); //NEW CODE
- I kept testing the project. The new function seemed to silently fail without throwing an error. I suspect this is because the new code runs BEFORE
gotoAndStop(), which leads to a null reference; I haven’t jumped to the frame withanimationon it yet. (I think this is an undesirable behavior; gotoAndStop should run first.)
The function failed silently because Menu.animation was technically set – it was just set to an outdated value that was still in memory. - I did a hard refresh, since things seemed funny. (I had already bumped into a similar bug.)
- I tested the project again, and got an error:
Menu.animation is not defined
I’m not exactly sure if this theory is correct, but I gotta go finish game jam stuff so I can’t investigate it right now. Hope this helps!