tailieunhanh - adobe flash cs5 on demand part 61

Phát triển các giải pháp xây dựng với sự kiện DOM3 Model ActionScript bây giờ hỗ trợ cú pháp ECMAScript, DOM3, mô hình sự kiện. Trong điều kiện của giáo dân, điều này có nghĩa là bạn đang sử dụng các đối tượng Listener để phát hiện khi bạn tương tác với bộ phim Flash của bạn bằng cách sử dụng bàn phím, chuột, hoặc những cử chỉ mới giao diện sử dụng trực tiếp chạm vào màn hình. | Developing Solutions Built with the DOM3 Event Model ActionScript now supports the ECMAScript DOM3 event model syntax. In laymen s terms this means that you now use the Listener object to detect when you interact with your Flash movie using either a keyboard mouse or the new gesture interfaces used in touching the screen directly. This is a big move from ActionScript . As an example the following script is ActionScript that instructs a Movie Clip to jump to frame 25 of a movie ActionScript uses Listeners to trigger when an event occurs. Listeners are more complex to work with but give you more flexibility. There are essentially two parts to a Listener. The first is a function that describes what is going to happen when you trigger an event. The second is the Listener that waits for a specified event to happen such as mouse clicking on a button. The following steps adds an ActionScript event that mimics the same event as the ActionScript example above. Use ActionScript Click the File menu click New click ActionScript and then click OK. Create a new Movie clip on the Stage with the name myMovie. Create a new layer in the Timeline with the name Actions and then select the layer. Open the Actions panel create the function and then add the listener that triggers the function. The function is called gotoFunction and the parenthesis dictates that it is looking for a mouse driven event. There is only one instruction in the function the gotoAndStop function that moves the Timeline to frame 25. The first part of the Listener myMovie instructs ActionScript to target the movie clip object on the Stage. The second part of the Listener addEventListener instructs Flash that you are using the Listener parenthesis has two parts that explain that the event is a mouse event and to use the function gotoFunction. The ActionScript event model gives you flexibility to write more complex scripts and to extend the functionality of the event .