TAILIEUCHUNG - Using the Key Class to Add Interactivity

Xác định một phím cụ thể hiện đang ép Xác định trọng điểm cuối ép Lấy giá trị mã khóa của khóa cuối ép Thêm một Listener rằng đồng hồ cho một sự kiện chính Xác định một phím nào đó (chẳng hạn như Caps Lock) là toggled hoặc tắt Các lớp học chính là một lớp học cấp cao nhất, có nghĩa là bạn không thể tạo ra một thể hiện mới của nó. Việc sử dụng phổ biến nhất của giai cấp chính là để xác định xem một phím cụ thể được nhấn. Bạn sẽ sử dụng cú. | Using the Key Class to Add Interactivity The Key class is a useful tool for capturing key events from the user that is user interaction with the keyboard . You can employ the Key class for tasks such as these Determining whether a specific key is currently pressed Determining the last key pressed Obtaining the key code value of the last key pressed Adding a Listener that watches for a key event Determining whether a certain key such as Caps Lock is toggled on or off The Key class is a top-level class which means you cannot create a new instance of it. The most common use of the Key class is to determine whether a specific key is pressed. You would use this syntax to determine whether a key is being pressed The script uses the isDown method of the Key class to determine whether the Tab key is currently pressed down. It returns a result of either true or false. The parameter of the isDown method can reference either a specific key in the Key class or the key code of a specific key. Every key on your keyboard has a special number associated with it called a key code. For example the Tab key can be referenced using or by the number 9 which is its ASCII equivalent. This script is the essentially the same as the preceding one 9 In the next simple exercise you ll move a hot air balloon around the screen using your keyboard and the Key class. 1. Open in the Lesson04 Assets directory. This movie contains three layers Background Balloon and Actions. On the Balloon layer you ll see a movie clip instance of a hot air balloon with an instance name of balloon_mc. The Background layer simply displays an image. In this exercise you ll place actions on the first frame of the Actions layer. 2. With the Actions panel open select Frame 1 in the Actions layer and add this script 3. 4. var speed Number 3 5. At the end of this exercise you should be able to move the balloon with your arrow keys. Every time you press the key the balloon .

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.