A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: variable question

  1. #1
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    behind you

    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
    Proud member of The Absolute Noobs

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Here, no there
    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();


    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();
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

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

Click Here to Expand Forum to Full Width

HTML5 Development Center