Search code examples
arraysactionscript-3exceptionactionscriptflash-builder

TypeError when creating new array


The following line of code sometimes throws an exception:

var stopScheduleItems:Array = [];

The exception being thrown:

TypeError: Error #1010: A term is undefined and has no properties.

I cannot understand why this could happen when creating a new array. Could anyone provide some insight. Thanks


Solution

  • This line can't be throwing this error.

    It's more likely that you are trying to access a method of the stopScheduleItems object before it's defined. For example something like this:

    stopScheduleItems.pop();
    var stopScheduleItems:Array = [];