|
-
I've just had a revelation! Ever heard of the 'eval' statement?
Layer=0;
Card = new Array();
for(i=0;i<4;i++){
Card[i] = new Array();
for(j=0;j<13;j++){
//Create an array of unique card names. Note: This only works when i is a single digit! Or you would have to think more carefully about creating the array.
Card[i][j] = "Card"+i+j;
this.attachMovie( "Card", Card[i][j], Layer );
Layer++;
//SetProperty method is fine evaluating the value of Card[i][j], but .gotoAndStop is not!
setProperty(Card[i][j],_x,60*i+25);
setProperty(Card[i][j],_y,80*j+37.5);
//Here we use the eval method to obtain the value held in the array. It now works!
eval(Card[i][j]).CardM.gotoAndStop(2);
//Passing the values of i & j to the card itself can be very useful!
Card[i][j].CardM.Var1=i;
Card[i][j].CardM.Var2=j;
}
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|