TAILIEUCHUNG - Học Actionscript 3.0 - p 7

Vectors a database had three records, it would be equivalent to one array of three arrays. Creating this arrangement is as simple as using an inner array as a value for one of the indices of the outer array. You can do this at the outset, or add it using push()—both of which are demonstrated here: var mdArray1:Array = ["a", "b", ["c", "d"]]; var mdArray2:Array = ["e", "f"]; (["g", "h"]); To access values in a multidimensional array, you must use multiple brackets to go into the nested arrays. For instance, continuing the prior example to retrieve the first item in the array mdArray1, you need only the standard single bracket syntax: trace(mdArray1[0]); //traces "a" to the Output panel However, to access. | Vectors a database had three records it would be equivalent to one array of three arrays. Creating this arrangement is as simple as using an inner array as a value for one of the indices of the outer array You can do this at the outset or add it using push both of which are demonstrated here var mdArray1 Array a b c d var mdArray2 Array e f g h To access values in a multidimensional array you must use multiple brackets to go into the nested arrays. For instance continuing the prior example to retrieve the first item in the array mdArray1 you need only the standard single bracket syntax trace mdArray1 0 traces a to the Output panel However to access the values in the nested array requires two components. First you must identify the nested array as the third item of mdArray1 at index 2 . Then you must reference the item within that nested array with another pair of brackets. So to retrieve c which is the first item in the nested array the syntax is as follows trace mdArray1 2 0 traces c to the Output panel This makes sense if you think about it in steps because not only is mdArray1 an array requiring bracket syntax to retrieve an item therein but mdArray1 2 is also an array requiring its own brackets to retrieve an item. NOTE There is another kind of array called an associative array which is often used interchangeably with custom objects. We ll discuss both in the Custom Objects section later in this chapter. Vectors Vectors not to be confused with the precise lines curves and shapes created by such object-drawing tools as Adobe Illustrator are typed arrays. Arrays like those in the previous section can contain data of any type. The following example array includes a String Number and Boolean var arr Array new Array arr 0 avocado arr o 2 arr 0 true A vector however can contain data of only one type which is determined at the time the vector was created. Although vector syntax may look a little odd at first its principle uniqueness is the addition of .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.