-
variable question
ok I've been working with a tutorial and I've come across this thing where when you start a variable it has something like this.
var game:Game = new game();
I've worked with other programming languages and with them it was just
var game=(whatever)
so I'd like to know what the :game and new game() are for
by the way the tutorial has a class called Game if that helps to explain it
-
In that case, you are instantiating a new class called Game. In essence, the variable game will contain the functions of the Game class. This is the same as when you create a new array or movieclip
var arr:Array = new Array();
or
var mc:MovieClip = new Movieclip();
Of course it is case sensitive so if the class is named Game, then the call would be
var game:Game = new Game();