tailieunhanh - adobe press ActionScript 3.0 for ADOBE FLASH PROFESSIONAL CS5 Classroom in a Book phần 8
Kiểm tra các bộ phim. Trong môi trường thử nghiệm, nhấp vào nút Take A Ảnh chụp. Cánh tay đồ họa động đất trên máy ảnh đồ họa. Chú ý rằng ngay cả khi bạn thêm mã để kiểm soát sự chuyển động của doanh chỉ có một, toàn bộ các phần ứng di chuyển xuống và uốn cong ở tất cả các khớp xương của nó. | 6 Test the movie. In the testing environment click the Take A Snapshot button. The arm graphic should animate down and land on the camera graphic. Notice that even though you added code to control the movement of only one joint the entire armature moved down and bent at all of its joints. 7 Close the file to leave the testing environment. Next you will add code to the moveUp function to return the armature to its original position. Coding the moveUp function After the moveDown function sends the armature to its target location near the camera graphic the moveUp function will return it to its original position. The code for the moveUp function is similar to that for the moveDown function but reversed. 1 Between the curly braces of the moveUp function add code so that the function reads function moveUp e Event void if 165 var pt0 Point new Point - 5 - 5 pt0 else stener moveUp true Notice that this function sends the jt0 joint back five pixels on each frame - 5 - 5 until its y location has returned to 165. 274 LESSON 12 Delving Deeper into Graphics and Animation with ActionScript When the armature is back in its original position there is no further reason for this function to continue so it is removed. At this point the snapshot_btn instance is made visible so that it can be used again. 2 Test the movie. The arm graphic should now move up and down. Notice the Take A Snapshot button disappear for the duration of the animation. You will add code to both the moveUp and moveDown functions but first let s use ActionScript to load some sound effects into this project. These will be used to enhance the armature movement. Creating Sound and Soundchannel instances The two sound files that accompany this lesson and will be triggered to play while the armature is animating. The
đang nạp các trang xem trước