LunaticSky
Messages postés8Date d'inscriptionmardi 2 janvier 2007StatutMembreDernière intervention28 juin 2007
-
24 mai 2007 à 16:36
LunaticSky
Messages postés8Date d'inscriptionmardi 2 janvier 2007StatutMembreDernière intervention28 juin 2007
-
25 mai 2007 à 17:41
salut
j'essaie de faire un jeu du memory en utilisant les classes ( je cherche le meilleur moyen) et j'ai un petit souci:
dynamic class Card {
private var idCard:Number= new Number();
private var nameCard:String;//ex: agW
public static var tabID = new Array("ag","aw","hg","hw","dg","dw","cg","cw");
public static var iD :Number = 0;
//constructor
function Card (){
var i:Number = new Number();
//create a number between 1 and 8
i=Math.floor(Math.random() * (9 - 1)) + 1;
//create randomly a card
nameCard=tabID[i];
//attach the movie clip concerned from the library
this.attachMovie('"'nameCard'"','"'nameCard'"', 1);
//lonely id numbered of the card
iD=iD+1;
idCard=iD;
}
// when its not two identical cards
function hideCard() {
//carte invisible
this._visible=false;
//face cachee
//this.attachMovie("carte","carte", 1);
}
//when we click on a card
function discoverCard() {
this._visible=true;
}
// when we found two identical cards
function staticGrey() {
//card become grey
this._alpha=30;
//manque du code
};
}
j'essaie de creer un id unique pour chaque carte et quand je fais :
iD=iD+1;
idCard=iD;
il me dis que j'ai pas le droit de faire ca, pk? 0_0
**Error** C:\Documents and Settings\temp\Desktop\stageGD\ficFlashCode\Card.as: Line 23: This statement is not permitted in a class definition.
iD=iD+1;
**Error** C:\Documents and Settings\temp\Desktop\stageGD\ficFlashCode\Card.as: Line 24: This statement is not permitted in a class definition.
idCard=iD;