Archive | ActionScript 3

Reassigning Variables in ActionScript 3

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:

VariableName = Value;

Example:

var nCustom:Number = 357;
nCustom = 678;

Woshka

Posted in ActionScript 3 Lesson 1 Variables Basics0 Comments

Declaring variables in ActionScript 3

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

var nCustom:Number = 357;

multiply avriables also could be declared in a single line

var CustomName1:DataType, CustomName2:DataType

Example:

var sName:String, var sFamilyNAme:String

lets anatomize every thing is used in this Example:

var nCustom:Number = 357;

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 Basics0 Comments

Understanding DataTypes in ActionScript 3

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 Basics0 Comments


Plese subscribe to my newsletter

Please subscribe via your email to follow me

E-mail:

Subscribe
Unsubscribe