Introducing to Variable

Introducing to Variable
Variable is a location in computer memory that used to save a value and it can be changed. There are 2 way to make variable in flash, first is write variable name and it value directly, example :
score = 1000; with this action automatically will create new variable with namely score and the value is 1000.

Second is typing action var before variable name that we type, example :
var score = 1000; with this action automatically will create new variable with namely score and the value is 1000.

Name rule in variable :
  • a variable must not same with instance name of symbol.
  • space, dot, and other punctuation can’t be used.
  • Cant use name that same with flash command like : obyek, level, break and others.
  • Variable name must not use only number, but variable name can following with number. Wrong example :12, 13, and others, Right example : score1, score_2 and others.
  • Variable name is not case sensitive, there are no different between lower or uppercase.


Variable Type
There are several variable type in flash, the most that used are :
Variable Type
Writing Sample
Number
score = 1000;    i++;
String
name = “”;    text = “example”
Boolean
death = true;    lose = false;
array
playerdata = [];
date = [“monday”, “tuesday”];
highscore = [100,90,60];

Post a Comment

0 Comments

-------- MASUKAN KODE IKLAN 1 --------
-------- MASUKAN KODE IKLAN 2 --------
-------- MASUKAN KODE IKLAN 3 --------
To Top