- Home /
Javascript Array class problem
I have a large Javascript (nearly a thousand lines) using exclusively the Array() class (often nested). It had worked in the past, but recently it began to cause problems. It failed to compile. The errors are invariably one of the following:
Assets/Standard Assets/Scripts/MetaMorph.js(311,74): BCE0019: 'length' is not a member of 'Object'.
Assets/Standard Assets/Scripts/MetaMorph.js(313,96): BCE0048: Type 'Object' does not support slicing.
Assets/Standard Assets/Scripts/MetaMorph.js(329,70): BCE0004: Ambiguous reference 'parseFloat':
I was told to replace Every instance of the Array() class with a builtInArray[]. And I can see that this will work. But the script is rather complex, it is beyond me to fix it. Also, it had worked in the past. So, what's the issue now?
Is there an alternative solution?
Please help!
Answer by DaveA · Oct 07, 2011 at 06:32 PM
Make sure your variables are all typed as Array.
Ex
var myArray; // this will likely cause the problem
var myArray : Array; // this will likely fix the problem
Your answer
Follow this Question
Related Questions
Javascript How to Activate/Deactivate GameObject Arrays 1 Answer
InvalidCastException error and logic error 1 Answer
How to use Javascript Array with classes? 1 Answer
"For"-Loop only works for final element in array 1 Answer
Arrange ints from biggest to smallest and display them in a table 1 Answer