Type 'object' does not support slicing, Need Help!

Hello everyone! Thanks for coming to check out my question and provide some feedback.
I’ve looked through the forum and found a few threads relating to the problem and I understand better now whats going wrong but am struggling to fix it. If someone could provide some insight it would be greatly appreciated, I’ve only been programming for a few months and still struggle with some things, in this case arrays.

I’m using the example from the Unity game book but I modified it more into a traditional memory game instead of the one with robots. I’m also trying to port it over to my nexus 7 so I don’t think pragma strict has anything to do it ( saw that mentioned in other questions )

Thanks again for having a look over my code.


The errors im having are:

Assets/Scripts/GameScript.js(44,1): BCE0077: It is not possible to invoke an expression of type ‘Array’.

ssets/Scripts/GameScript.js(88,19): BCE0077: It is not possible to invoke an expression of type ‘Array’.

I am also getting
Assets/Scripts/GameScript.js(90,9): BCE0019: ‘isMatched’ is not a member of ‘Object’.

But i thought that might be fixed when the other lines are corrected?

Thank you again for helping.

Cheers and Beers

Nick Wilson.

Never use the Array class; it’s slow and untyped. Use built-in arrays or generic Lists instead.

You have 3 errors in your script:

The first two errors are actually the same. This:


should be this


Your last error comes from the fact that your “card” variable (defined at the same line as your second error) is of type “Object”. You should use the type Card since only your Card class has the isMatched variable.
var card : Card = aGrid*[j];*
Beside those mistakes like Eric said you should use a List instead
instead of
Keep in mind that a List has slightly different functions than the Array class.