tailieunhanh - Making the Most of Attaching Mouse Events to Movie Clips
Để làm một đoạn phim được đối xử như một nút, chỉ cần đính kèm một sự kiện chuột vào nó. Theo hầu hết các trường hợp, bạn không thể đính kèm cả các sự kiện chuột và clip các sự kiện để một trường hợp duy nhất. Tuy nhiên, bạn có thể sử dụng các phương pháp xử lý sự kiện (được thảo luận sau này trong bài học này) để thiết lập một ví dụ movie clip phản ứng với cả hai sự kiện chuột và clip | Making the Most of Attaching Mouse Events to Movie Clips Movie clip instances can also have attached mouse events as shown in the preceding exercise . To make the most of this powerful capability you need to be aware of a few things To cause a movie clip to be treated as a button simply attach a mouse event to it. Under most circumstances you cannot attach both mouse events and clip events to a single instance. However you can use event handler methods discussed later in this lesson to set a movie clip instance to react to both mouse and clip events. When a movie clip instance is assigned mouse events so that Flash recognizes it as a button it retains all of its movie clip functionality. When a movie clip instance is assigned mouse events so that Flash recognizes it as a button a hand cursor will appear when the user places his or her mouse over it. If you want a movie clip instance to act like a button but don t want the hand cursor to appear set the useHandCursor property of the instance to false with a rollOver event on rollOver false The useHandCursor property can be set for button instances as well covered later . Although you can place mouse events on movie clip instances you cannot place clip events on button instances as we ll discuss later in this lesson . Button instances can be assigned instance names and they have properties similar to movie clip instances for example _alpha _rotation _y and so on . Thus if you give a button an instance name of myButton_btn you can change its transparency using 50. Although you can assign instance names to buttons and they re treated similarly to movie clip instances employing properties and methods buttons aren t independent timelines while movie clips are an important thing to remember when using the term this as a target path. For example if you were to place the following script on a movie clip instance the instance itself would rotate on press 30 However if you were
đang nạp các trang xem trước