tailieunhanh - Controlling the Playback Speed and Direction of a Timeline

Thông thường, một thời gian đóng phim trong một hướng về phía trước với tốc độ do nhà fps (khung hình / giây) thiết lập trong hộp thoại Properties Movie. Tuy nhiên, bạn có thể kiểm soát sự chỉ đạo, trong đó thời gian di chuyển cũng như tốc độ của nó bằng cách sử dụng ActionScript. Trong thực tế, bằng cách kết hợp các yếu tố kịch bản (mà điều khiển hướng) với các sự kiện onEnterFrame, bạn có thể giành quyền kiểm soát tuyệt vời hơn thời gian của dự án. | Controlling the Playback Speed and Direction of a Timeline Normally a movie s timeline plays in a forward direction at a pace dictated by the fps frames per second setting in the Movie Properties dialog box. However you can control the direction in which the timeline moves as well as its speed by using ActionScript. In fact by combining scripting elements which control direction with the onEnterFrame event you can gain incredible control over the project s timeline. The first two scripting elements we ll discuss are the nextFrame and prevFrame methods of the MovieClip class. You use these methods to move a timeline to the next or previous frame by employing the following syntax function or function By assigning these event handlers to buttons you can create navigation controls that automatically advance or rewind a timeline one frame at a time with each click of the button. Even more powerful is a timeline s _currentframe property a read-only property its value represents the frame number at which the playhead currently resides. For example if the main movie is being played the following script places the numerical value of the playhead s current frame position into a variable named whereAreWe var whereAreWe Number You can also use this property in conjunction with a conditional statement to determine when the playhead is within a specific range of frames and make it act accordingly function if 50 100 Perform these actions In this script the actions within the conditional statement are executed only when the playhead on the main timeline is between Frames 50 and 100. Using the _currentframe property in conjunction with a gotoAndPlay action allows you to control the direction as well as the pace in which the timeline moves. In the following example the playhead on the main timeline advances 10 .