Copy link to clipboard
Copied
I have an array that holds the animations for a character MovieClip. On the first frame there is code which accesses this array (both are on the same layer and frame)
var attackList: Array = new Array();
attackList.push('dashBurst', 'punch');
curAnim = attackList[randomCalc(0, attackList.length)];
curAnim exists and can be defined in a different way.
By using trace statements I determined that flash was not getting any index at all from attackList. I tried attackList[0] and [1] and both threw the same error.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
randomCalc is just a function that generates a random whole number between two values.
Why am I getting this error?
I got it now.
On the main timeline there was a line telling the MovieClip to skip that frame.
Oops.
Copy link to clipboard
Copied
I just found out that none of my Arrays are able to be accessed at all.
What am I doing wrong?
Copy link to clipboard
Copied
Adding more trace statements shows that none of the arrays, variables, import statements, or anything are being run.
???
Copy link to clipboard
Copied
I got it now.
On the main timeline there was a line telling the MovieClip to skip that frame.
Oops.
Copy link to clipboard
Copied
See Array - Adobe ActionScript® 3 (AS3 ) API Reference‌, maybe you should use " instead '.
var attackList: Array = new Array();
attackList.push("dashBurst", "punch");
Or try another way:
var attackList: Array = new Array("dashBurst", "punch");
Hope this help!