ThisLike Jonathan Hobbs said, I've made a few changes.
This is what I modified those code
var cardW:int = 100; //card width = 100
var cardH:int = 100;
var aCards:Array; //every cards will be stored in this array
//var aGrid:Array; //this array will keep track of the shuffled, dealt cardsArray
var aGrid:Card[,];
var aCardsFlipped:ArrayList; // This array will store the two cards that player flips over
var<-- playerCanClick:boolean;change //Wehow willyou usedeclare this flag to prevent the player from clicking buttons when we don't want himvariable to
var playerHasWon:boolean = false; // Store wehter or not the player has won
class Card extends System.Object
{
var isFaceUp: boolean = false;
var isMatched: boolean =multidimensional false;arrays
var imgaCardsFlipped:String;
function Card()
{
img = "robot";
}
}
ArrayList;
And change this in the Start function
function Start () {
playerCanClick = true;
//initialize the array as empty lists
aCards = new Array();
aGrid = new Card[rows,cols]; //<-- I instantiate beforeit useas rows*cols array
aCardsFlipped = new ArrayList();
for (var i=0;i<rows;i++)
{
for (var j=0;j<cols;j++)
{
aGrid[i,j] = new Card(); //Assign<-- Then assign the value like this
}
}
}
Hope this help