Built-In Object Classes

Mặc dù là một điều kiện có thể mất nhiều hình thức, tại cốt lõi của nó nó đại diện cho một tình hoặc là có đúng hay sai. chúng tôi kế hoạch để có một cách tiếp cận cực kỳ chính xác của một trường hợp clip phim | Built-In Object Classes In the next section we ll briefly review many of the built-in object classes that ActionScript provides as well as some ways they are used. Before we do however it s important to discuss how to actually get instances of classes into your project in the first place so you can begin to utilize their power and functionality. You can create object instances in one of two ways. To create a new instance of the MovieClip Button or TextField class you create it on the stage or drag it onto the stage from the library. However only MovieClip Button and TextField instances can be created in this way. To create an instance of any other class you must use a constructor a simple line of code that tells Flash to create an object instance of a particular class. A constructor looks like this nameOfInstance nameOfClass new nameOfClass If you wanted to create an instance of the Sound class the constructor would look like this mySound Sound new Sound Whenever you create an object instance you must give it a unique name. This allows you to change a property or invoke a method as it relates to that particular instance remember an instance inherits all the properties and methods of the class to which it belongs . We ll demonstrate the concept in examples. As you gain programming experience you ll begin to understand when you should use constructors. While instances of the MovieClip TextField and Button classes can be created on the stage manually by dragging them from the library they can also be created dynamically using ActionScript. NOTE Object names follow the same naming conventions as variables which means they can t contain spaces symbols or a number as the first character. Some object classes are known as top-level classes which means you can t create instances of them using the methods we ve shown. What differentiates these classes from those of which you create instances Top-level classes represent and control global functionalities within your project.

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
114    76    2    20-05-2024
Đã 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.