Posted on 01 March 2010.
Reassigning is as easy as declaring variables in ActionScript but in diffrence of without any var keyword and datatype section.
You can reassigne any variables as much times as you want in every line but keep in mind that you have to reassigne a variable that has been declared before.
structure:
Example:
var nCustom:Number = 357;
nCustom = 678;
Woshka
Posted in ActionScript 3 Lesson 1 Variables Basics
Posted on 01 March 2010.
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:
var CustomName:DataType;
CustomName = value;
and a a varianble can also be declared and assigned with a value in a single line
var CustomName:DataType = value;
Examples:
var nCustom
:Number;
nCustom =
357;
or
multiply avriables also could be declared in a single line
var CustomName1:DataType, CustomName2:DataType
Example:
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
sMyName
or you can name like this
MyName
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.
Posted in ActionScript 3 Lesson 1 Variables Basics
Posted on 01 March 2010.
to have a better understand of variables and the way to create them first yu should know what datatype is.
when we talk about data, we mean the information that can be stored or be written that can be unnderstand has amny kinds.
the same thing is also true in real world
suppose you have a math problem so the data included in that has the value of numbers
or when writting an esay the value has a datatype of text
or just having one sentence the value has a datatype of string
so in ActionScript when you want to create a variable that can hold dta containing numbers you should mention the value type as an number that the variable can contain in the variable decleration
the same for other datatype such as strings or text.
so I hope I could have created a view of what a datatype is in this post
Posted in ActionScript 3 Lesson 1 Variables Basics
Recent Comments