INSTANCE NAMES are unique names that allow you to target movie clip and button instances in scripts. You use the Property inspector to assign instance names to instances on the Stage. [r]
(1)Tiếng Anh dùng cho Macromedia Flash: Bài 1 Understanding ActionScript overview
1. script = một tập các chỉ lệnh để báo cho chương trình cách thực hiện (đừng dịch từ này sang tiếng Việt làm gì cho mệt, chỉ hiểu nghĩa thơi là đủ rồi)
2. language = ngơn ngữ (VD : Pascal, Delphi, Visual Basic) 3. create = tạo ra, tạo nên
> creator (n)
4. element = thành phần, thành tố 5. incorporate = hợp nhất
6. complicated = phức tạp = complex (giống như bài Complicated Heart của MLTR đó ) 7. syntax = cú pháp
8. reverse = đảo ngược 9. include = bao gồm
exclude = khơng bao gồm, loại ra 10. provide = cung cấp
11. keyword = từ khóa (VD : for, while,…) 12. operator = tốn tử (+,,x, :,…)
13. allow = cho phép 14. store = lưu trữ
15. retrieve = get = lấy ra 16. information = thông tin 17. builtin : xây dựng sẵn 18. function : hàm
19. object = đối tượng
20. style = phong cách > stylish (sành điệu) 21. resemble = tương tự, tương đồng
22. previous = trước đây next = kế tới
23. chapter = chương
24. introduce = giới thiệu (mọi người thường hay gọi ngắn gọn là intro đó, có nhớ khơng) 25. objectoriented = hướng đối tượng
(2)33. statement = phát biểu, câu lệnh
34. conditional = điều kiện (if then…else…) 35. loop = vịng lặp (for, while)
36. construct = xây dựng, dựng (hình) 37. contain = chứa đựng
content = nội dung 38. detailed = chi tiết
39. entry = mục nhập (hiểu sao cũng được, là từ họ hàng với “enter” đó…) 40. right away = ngay lập tức
Đoạn văn :
Understanding ActionScript overview
ActionScript, the scripting language of Macromedia Flash MX, allows you to create a movie that behaves exactly as you want. You don't need to understand every ActionScript element to begin scripting; if you have a clear goal, you can start building scripts with simple actions. You can incorporate new elements of the language as you learn them to accomplish more complicated tasks.
Like other scripting languages, ActionScript follows its own rules of syntax, reserves keywords, provides operators, and allows you to use variables to store and retrieve information. ActionScript includes builtin objects and functions and allows you to create your own objects and functions.
The ActionScript syntax and style closely resemble that of JavaScript. Flash MX understands ActionScript written in any previous version of Flash.
This chapter introduces you to ActionScript as an objectoriented scripting language and provides an overview of ActionScript terms and basic programming concepts such as functions, variables, statements, operators, conditionals, and loops. It also deconstructs a sample script so that you can begin to understand ActionScript syntax. The online
ActionScript Dictionary contains a detailed entry for every ActionScript element
Bài 2 : ActionScript terminology(phần1)
1. terminology = thuật ngữ = term 2. like = as = tương tự
3. own = chính nó, tự nó (VD : on her own = của chính cơ ta)
4. follow = theo sau (nghe giống như giáo trình tiếng Anh : FOLLOW ME đó) 5. order = thứ tụ
6. alphabetical = xếp theo thứ tự chữ cái 7. Action = hành động
(3)10. playhead = thanh tiến trình trong flash (khi nhấn Enter thì có một thanh chạy theo thời gian, nó đó)
11. manual = sổ tay, sách học, làm bằng tay, làm một cách thủ cơng 12. specific = nhất định
13. label = nhãn
14. interchangeable = có thể thay thế lẫn nhau 15. value = giá trị
16. boolean = luận lý, có tính lơgic 17. Class = lớp
18. data type = kiểu dữ liệu
19. define = xác định > definition = định nghĩa 20. constructor = xây dựng
21. meaning = ý nghĩa
22. indicate = cho biết, chỉ, ra dấu
23. keyboard = bàn phím (hơng phải cây đàn organ nha) 24. compare = so sánh
25. property = tính chất
26. method = phương pháp,phương thức
27. code = đoạn mã (từ này cũng ít ai dịch ra nghĩa tiếng Việt làm gì, cứ gọi “cót” hay “cốt” gì đó nghe oai hơn )
28. Circle = vịng trịn
center = tâm ; radius = bán kính ; diameter = đường kính ; sphere = hình cầu ;
circumference = perimeter = chu vi ; square = diện tích ; volumn = thể tích ; arc = cung trịn
29. set = tập hợp
30. operation = q trình hoạt động, phép tốn 31. perform = thực hiện
32. string = chuỗi
33. null = đối tượng rỗng
34. undefined = đối tượng khơng xác định 35. Event = Sự kiện
36. occur = xảy ra = happen
37. generate = phát ra, phát sinh > generation = thế hệ 38. enter = đến, chạm đến
39. load = nạp
40. Event handlers = (tạm dịch) Phần kiểm sốt hành động 41. manage = quản lí, kiểm sốt
42. kind = loại
(4)44. subcategory = (tạm dịch) hạng con, phạm trù con Đoạn văn :
ActionScript terminology
Like any scripting language, ActionScript uses its own terminology. The following list provides an introduction to important ActionScript terms in alphabetical order.
ACTIONS are statements that instruct a movie to do something while it is playing. For example, gotoAndStop sends the playhead to a specific frame or label. In this manual, the terms action and statement are interchangeable.
BOOLEAN is a true or false value.
CLASSES are data types that you can create to define a new type of object. To define a class, you create a constructor function.
CONSTANTS are elements that don't change. For example, the constant Key.TAB always has the same meaning: it indicates the Tab key on a keyboard. Constants are useful for comparing values.
CONSTRUCTORS are functions that you use to define the properties and methods of a class. For example, the following code creates a new Circle class by creating a constructor function called Circle:
function Circle(x, y, radius){ this.x = x;
this.y = y;
this.radius = radius; }
DATA TYPES are a sets of values and the operations that can be performed on them. The ActionScript data types are string, number, boolean, object, movieclip, function, null, and undefined.
EVENTS are actions that occur while a movie is playing. For example, different events are generated when a movie clip loads, the playhead enters a frame, the user clicks a button or movie clip, or the user types at the keyboard.
EVENT HANDLERS are special actions that manage events such as mouseDown or load. There are two kinds of ActionScript event handlers: actions and methods. There are only two event handler actions, on and onClipEvent. In the Actions toolbox, each ActionScript object that has event handler methods has a subcategory called Events.
Bài 3 : Actionscript Terminology (phần 2)
(5)3. combination = sự kết nối, kết hợp 4. symbol = biểu tượng, kí hiệu 5. represent = đại diện
6. consist of = bao gồm
7. operand = số hạng, toán hạng 8. block = khối
9. reusable = tái sử dụng được 10. pass = chuyển tới
11. return = trả về 12. version = phiên bản 13. currently = hiện tại 14. Identifier = từ định danh 15. underscore = dấu gạch ( _ ) 16. sign = kí hiệu
17. subsequent = theo sau, tiếp theo 18. instance = phiên bản
19. belong to = lệ thuộc vào 20. certain = nhất định 21. unique = độc nhất
22. target = xác định, mục tiêu
23. Property inspector : Công cụ kiểm tra Properties của Flash 24. assign = giao nhiệm vụ, gán
25. master symbol = biểu tượng gốc 26. reserved = dành riêng
27. declare = khai báo 28. local = cục bộ 29. collection = tập hợp 30. particular = cá biệt
31. predefine = định nghĩa trước, xác định trước 32. calculate = tính tốn
33. manipulate = thao tác, điều khiển bằng tay (thường dùng cho Sound); thao túng (thị trường chứng khốn)
34. placeholder = (tạm dịch) nơi lưu trữ
35. argument = đối số, tham số, (có khi cịn mang nghĩa là “lý lẽ, sự tranh luận”) 36. attribute = thuộc tính
37. visible = thấy được 38. hidden = ẩn
(6)41. root = gốc, rễ 43. direct = chỉ đường
44. equal sigh = dấu bằng (“=”) Đoạn văn :
ActionScript terminology
EXPRESSIONS are any legal combination of ActionScript symbols that represent a value. An expression consists of operators and operands. For example, in the expression x + 2, x and 2 are operands and + is an operator.
FUNCTIONS are blocks of reusable code that can be passed parameters and can return a value. For example, the getProperty function is passed the name of a property and the instance name of a movie clip, and it returns the value of the property. The getVersion function returns the version of the Flash Player currently playing the movie.
IDENTIFIERS are names used to indicate a variable, property, object, function, or method. The first character must be a letter, underscore (_), or dollar sign ($). Each subsequent character must be a letter, number, underscore, or dollar sign. For example, firstName is the name of a variable.
INSTANCES are objects that belong to a certain class. Each instance of a class contains all the properties and methods of that class. All movie clips are instances with properties (for example, _alpha and _visible) and methods (for example, gotoAndPlay and getURL) of the MovieClip class.
INSTANCE NAMES are unique names that allow you to target movie clip and button instances in scripts. You use the Property inspector to assign instance names to instances on the Stage. For example, a master symbol in the library could be called counter and the two instances of that symbol in the movie could have the instance names scorePlayer1 and scorePlayer2. The following code sets a variable called score inside each movie clip instance by using instance names:
_root.scorePlayer1.score += 1; _root.scorePlayer2.score = 1;
KEYWORDS are reserved words that have special meaning. For example, var is a keyword used to declare local variables. You cannot use a keyword as an identifier. For example, var is not a legal variable name.
METHODS are functions assigned to an object. After a function is assigned, it can be called as a method of that object. For example, in the following code, clear becomes a method of the controller object:
(7)}
controller.clear = reset; controller.clear();
OBJECTS are collections of properties and methods; each object has its own name and is an instance of a particular class. Builtin objects are predefined in the ActionScript
language. For example, the builtin Date object provides information from the system clock.
OPERATORS are terms that calculate a new value from one or more values. For example, the addition (+) operator adds two or more values together to produce a new value. The values that operators manipulate are called operands.
PARAMETERS (also called ARGUMENTS) are placeholders that let you pass values to functions. For example, the following welcome function uses two values it receives in the parameters firstName and hobby:
function welcome(firstName, hobby) {
welcomeText = "Hello, " + firstName + "I see you enjoy " + hobby; }
PROPERTIES are attributes that define an object. For example, _visible is a property of all movie clips that defines whether a movie clip is visible or hidden.
TARGET PATHS are hierarchical addresses of movie clip instance names, variables, and objects in a movie. You name a movie clip instance in the movie clip Property inspector. (The main Timeline always has the name _root.) You can use a target path to direct an action at a movie clip or to get or set the value of a variable. For example, the following statement is the target path to the variable volume inside the movie clip stereoControl: _root.stereoControl.volume
VARIABLES are identifiers that hold values of any data type. Variables can be created, changed, and updated. The values they store can be retrieved for use in scripts. In the following example, the identifiers on the left side of the equal signs are variables: x = 5;
name = "Lolo";
(8)Bài 4. Equality operators (toán tử “so sánh bằng”)
1. Equality = bằng nhau, so sánh bằng 2. determine = xác định, quyết định 3. whether = có hay khơng = if
4. reference = tham chiếu (thường dùng cho mảng hay cho objects) 5. common = phổ biến
6. assignment = phép gán
7. incorrect = sai, khơng chính xác 8. strict = nghiêm
9. conversion = sự chuyển đổi 10. inequality = bất đẳng thức 11. inversion = phép nghịch đảo Đoạn văn
Equality operators
You can use the equality (==) operator to determine whether the values or identities of two operands are equal. This comparison returns a Boolean (true or false) value. If the
operands are strings, numbers, or Boolean values, they are compared by value. If the operands are objects or arrays, they are compared by reference.
It is a common mistake to use the assignment operator to check for equality. For example, the following code compares x to 2:
if (x == 2)
In that same example, the expression x = 2 is incorrect because it doesn't compare the operands, it assigns the value of 2 to the variable x.
The strict equality (===) operator is like the equality operator, with one important difference: the strict equality operator does not perform type conversion. If the two operands are of different types, the strict equality operator returns false. The strict inequality (!==) operator returns the inversion of the strict equality operator. The following table lists the ActionScript equality operators:
(9)!= Inequality !== Strict inequality (hết bài 4)
Bài 5 : Assignment operators (tốn tử “gán”)
1. multiple = nhiều, phức tạp, (trong lĩnh vực tốn cịn có nghĩa “bội số”)
2. compound = kép, ghép, phức hợp (trong lĩnh vực hóa học cịn có nghĩa “hợp chất”) 3. equivalent = tương đương
4. verbose = lắm lời, dài dịng
5. slightly = nhỏ, ở mức độ khơng đáng kể lắm 6. Addition = phép cộng
7. Subtraction = phép trừ 8. Multiplication = phép nhân 9. Division = phép chia
10. Modulo = phép chia module
11. bitwise shift left = (tạm dịch) dịch sang trái 1 bit (Bạn nào học lập trình Pascal qua sẽ biết cái này thơi)
Đoạn văn
Assignment operators
You can use the assignment (=) operator to assign a value to a variable, as in the following:
password = "Sk8tEr";
You can also use the assignment operator to assign multiple variables in the same expression. In the following statement, the value of a is assigned to the variables b, c and d:
a = b = c = d;
You can also use compound assignment operators to combine operations. Compound operators perform on both operands and then assign that new value to the first operand. For example, the following two statements are equivalent:
(10)x = x + 15;
The assignment operator can also be used in the middle of an expression, as in the following:
// If the flavor is not vanilla, output a message if ((flavor = getIceCreamFlavor()) != "vanilla") { trace ("Flavor was " + flavor + ", not vanilla."); }
This code is equivalent to the slightly more verbose code that follows: flavor = getIceCreamFlavor();
if (flavor != "vanilla") {
trace ("Flavor was " + flavor + ", not vanilla."); }
The following table lists the ActionScript assignment operators: = Assignment
+= Addition and assignment = Subtraction and assignment *= Multiplication and assignment %= Modulo and assignment /= Division and assignment
<<= Bitwise shift left and assignment >>= Bitwise shift right and assignment >>>= Shift right zero fill and assignment ^= Bitwise XOR and assignment
|= Bitwise OR and assignment &= Bitwise AND and assignment
Bài 6 : Arrays
(11)8. refer = liên hệ, tham khảo 9. index = chỉ mục
10. organised = có tổ chức 11. related = liên hệ 12. distinguish = phân biệt 13. suppose = giả sử, cho rằng 14. quote = phát biểu
15. numerous = đơng đảo, nhiều 16. problem = vấn đề
17. data = dữ liệu 18. position = vị trí 19. mention = đề cập
20. zero based = có yếu tố zero (số khơng) 21. basically = một cách đơn giản
22. brilliant = rực rỡ, chói lịa, lỗi lạc 23. aware of = ý thức đến, nhận thấy
24. initializer = phần tạo các phần tử ban đầu 25. entirely = trọn vẹn, hồn tồn
26. up to you = tùy vào bạn 27. prefer = thích hơn 28. access = truy cập
29. fortunately = một cách may mắn Đoạn văn
ARRAYS
If you are interested in arrays then I assume you already know about variables. Variables are a container for one piece of data, this piece of data can be a number, a string or a boolean value
(12)follows :
quote1 = “Flash is cool”
quote2 = “Flash is my favourite program” quote3 = “Flash rules”
However a better way may be to use an array, there are numerous ways of creating an array but I will show you the easiest way first :
name_of_array = new Array()
So to store our quotes in an array we could use : quotes = new Array()
OK that’s great we now have an array, but the problem is we don’t have any data inside if our array, that’s not very useful so we will now place data inside of our array, we do this by using an index number, the index number refers to the position in the array
To place a piece of data inside the first element of our array we would use : quotes[0] = “Flash is cool”
As I mentioned before, arrays in Flash are zero based, meaning that the first element in the array has an index of zero (0)
So to place a piece of data inside the second element of our array we would use : quotes[1] = “Flash is my favouite program”
We use this syntax to fill an element of an array with a piece of data : name_of_array[index] = value
Where name_of_array is the name of your array, the index is the position in your array and the value is the piece of data you want to add to your array
So the code we created earlier using variables : quotes1 = “Flash is cool”
(13)quotes3 = “Flash rules”
can also be written as follows using arrays : quotes = new Array()
quotes[0] = “Flash is cool”