When learning a foreign language, we should first learn its syntax. The same is true for learning a programming language. Syntax is the most basic thing in every programming language, such as how to define variables, use expressions, and perform basic operations.
ActionScript 3.0 is a script language based on ECMA-262 specifications. Its basic syntax consists of identifiers, keywords, data types, operators, and delimiters. These five elements have different syntax meanings and composition rules. They work with each other to complete the semantic expression of The ActionScript 3.0 language. This article focuses on the basic syntax structures of identifiers, keywords, data types, operators, and delimiters in ActionScript 3.0, as well as common knowledge points such as constants and variables in ActionScrpt 3.0, lay a solid foundation for learning ActinScript 3.0.
1. identifier
What is an identifier? A simple understanding is that every time we define a variable, this variable is called an identifier. In ActionScript 3.0, keywords and reserved words cannot be used as identifiers. Including the variable name, class name, and method name.
Ii. Keywords
In ActionScript 3.0, reserved words include "keywords" and we cannot use them as identifiers in code. List the keywords in ActionScript 3.0. For details, please refer to the official documents. I will not list them here. At the end of the article, I will provide the connection between the language and the component reference online document. below is the ActinScript 3.0 keyword online document address:
Http://help.adobe.com/zh_CN/AS3LCR/Flash_10.0/statements.html
Iii. Data Types
Data is a necessary component of the Program and an object for processing. A Data Type describes a data segment and various operations that can be performed on it. Data is stored in variables. When creating variables, object instances, and function definitions, you can use the data type class to specify the data type to be used. The data type is the abstraction of the data processed by the program.
There are two data types in ActionScript 3.0: primitive data type and complex data type. The following lists commonly used data types:
1. boolean: boolean type, which can be usedtrue
Orfalse
(Used for logical operations) one of the two values.
2. INT: indicates the Data Type of a 32-bit signed integer. The value range of the int class is-2,147,483,648 (-2 ^ 31) to 2,147,483,647 (2 ^ 31-1 ).
3. uint: A 32-bit unsigned integer data type method.
4. String: indicates the Data Type of a string of characters.
5. Number: indicates the Data Type of the double-precision floating point number of the IEEE-754.
6. Date: indicates the date and time information.
7 ,........
Iv. Operators
For details, see the official online documentation:Http://help.adobe.com/zh_CN/AS3LCR/Flash_10.0/operators.html
5. constants and variables
Using constants and variables in ActionScript 3.0 is the same as other programming languages. There is no big difference between them. The vertices are the same. Simply put, a constant is the amount that the value does not change, while a variable is the opposite.
In AS3.0, constants can also be divided into two types: top-level constants and user-defined constants. The so-called top-level constants are the constants provided in the language library. They are:
1. Infinity: positive Infinity
2.-Infinity: negative Infinity
3. NaN: indicates a non-numeric value.
4. undefined: a special value for uninitialized non-type variables or uninitialized dynamic object attributes.
The second is the User-Defined constant, which is usually defined by the keyword const.
No matter what programming language, variables are the most used, as is the case in ActionScript 3.0. How do I define variables in AS3.0? Variable Definition Format: var variable name: data type or var variable name: data type = initial value. Example of the following variable:
For example, define a string variable abcd and assign the initial value to "abcd ":
Var abcd: String = "abcd ";
Vi. Others
This article is full of basic theoretical knowledge, which can be found in the official reference manual for the language and component of the Event code 3.0, so I will not talk nonsense here, for more information, see the connections I have provided in this Article.
Connect the language and component of ActionScript 3.0 to the online document:Http://help.adobe.com/zh_CN/AS3LCR/Flash_10.0/
You can also go to this manual directly ,:Http://www.adobe.com/support/documentation/cn/
From: http://www.cnblogs.com/beniao/archive/2008/12/21/1359228.html