Declaring variable is easy but like other OOP languages you must follow some rules
some times we may mention creating or defining avariable instead of declaring but both of them are correct
the syntax of declaring variables is as follows:
CustomName = value;
and a a varianble can also be declared and assigned with a value in a single line
nCustom = 357;
multiply avriables also could be declared in a single line
lets anatomize every thing is used in this Example:
var:in every variable declaration this keyword hs to be used followed by the name of the variable.in prevous versions of ActionScript it was option wether to use this keyword or not but after the version 3 and later you must use this keyword.
nCustom:this is the name of the variable which you are declaring. this could be any word r strings of letters and numbers which begin with an underscore or a letter.I have seen so many convention for naming variables,some are to begin a descriptive word with the datatype first letter in lowercase followed by your custom name with the beginning name in upercase.some will tell to have your beginning letter in lowercas with a descriptive word in upercase.
to name a variable that holds String value
or you can name like this
it doesn’t matter how you name it and its upto you but there is some rules not to do is ,not to name your variableswith the kwywords or other special value that is recognized by ActionScript.
the name must be uniq.
:Number:this is the datatype that a varibale can hold.this “number” can be replaced by any other datatypes in actionscript.
357:this is the value that will be assigned to the variable.