tailieunhanh - Creating Movie Clip Instances Dynamically

Bạn sẽ sử dụng mỗi phương pháp trong quá trình làm việc thông qua các bài tập trong bài học này. Sử dụng duplicateMovieClip () Mặc dù chúng tôi giới thiệu phương pháp duplicateMovieClip trong Bài Học 9, "Tự động hoá Scripts với Loops," chúng tôi đã làm nó không bao gồm chi tiết. Bây giờ bạn có được để tìm hiểu mọi thứ bạn cần biết về phương pháp này mạnh mẽ. Sử dụng duplicateMovieClip () phương pháp, bạn có thể trực tiếp Flash để nhân bản một ví dụ movie clip đó là hiện nay trên sân khấu. | Creating Movie Clip Instances Dynamically You can create a movie clip instance dynamically by using one of the following methods of the Movie Clip class duplicateMovieClip This method duplicates an existing movie clip instance on the stage to create a new instance of that movie clip. attachMovie This method creates a new instance of a movie clip directly from the library. createEmptyMovieClip This method creates an empty movie clip instance that is one that contains no data or graphical content. You ll use each of these methods in the course of working through the exercises in this lesson. Using duplicateMovieClip Although we introduced the duplicateMovieClip method in Lesson 9 Automating Scripts with Loops we didn t cover it in detail. Now you get to learn everything you need to know about this powerful method. Using the duplicateMovieClip method you can direct Flash to duplicate a movie clip instance that s currently on the stage and give it a new instance name. If the movie clip instance is not on the stage that is it s in a previous frame or in a frame not yet visited Flash cannot duplicate it. In addition the movie clip instance can only be duplicated into the same timeline as the original and it will exist in the same relative hierarchical position as the original. NOTE To dynamically create a movie clip instance that also allows dynamic timeline insertion you would use attachMovie which we ll discuss later in this lesson. When a movie clip instance is duplicated the duplicate inherits all of the instance s current physical properties. A duplicated movie clip instance inherits the following properties from the original Position Scale Alpha Rotation Color Clip events attached to the movie clip instance A duplicated movie clip doesn t inherit the following Variables arrays objects Name Visibility Current frame NOTE A duplicated movie clip instance starts playing at Frame 1 even if the original from which it was copied was at another frame at the time the .