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.