TAILIEUCHUNG - Using Listeners

Người nghe Chỉ cần sử dụng như một máy phát sóng vô tuyến đơn đến hàng ngàn chương trình phát sóng radio, một số sự kiện có thể được "phát sóng" cho bất kỳ số lượng các đối tượng để họ đáp ứng phù hợp. | Using Listeners Just as a single transmitter broadcasts radio waves to thousands of radio receivers some events can be broadcast to any number of objects so that they respond accordingly. You do this by employing what are known as Listeners events that can be broadcast to objects that have been registered to listen for them listening objects . Suppose you wanted an object sound movie clip text field array or custom to react to a certain event s being triggered in your movie. You would first create an event handler method for that object function Here we ve set up a text field named myTextField_txt to react when the mouse button is pressed. The onMouseDown event is not a standard event that a text field can react to and at this point it still won t. For the text field to react to this event you must register the text field as a Listener for the event. You can do so by adding this code myTextField Here the text field is registered with the Mouse object because the onMouseDown event is a Listener of that object. Now whenever the mouse button is pressed the event handler method we created earlier will execute. You can set up any number of objects for a single Listener event as long as the object has been given an event handler method to deal with the event and the object has been registered to listen for that event. If you no longer want an object to listen for an event you can unregister it using this syntax myTextField Listeners give you a bit more flexibility for scripting how your projects react to various events. NOTE Not all events can be treated as Listeners. With this in mind be aware of which events are listed as Listeners in the Actions toolbox. If an event is not listed as a Listener other objects cannot be set up to listen to it. In the next exercise in honor of the new History panel found in Flash MX 2004 we ll create our own History panel named Bygones using Listeners.

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.