Danh mục

Targeting Movie Clip Instances on Levels

Số trang: 8      Loại file: pdf      Dung lượng: 21.37 KB      Lượt xem: 11      Lượt tải: 0    
Hoai.2512

Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Nhắm mục tiêu Movie Clip trường hợp về trình độ mục tiêu là một ví dụ movie clip mà tồn tại trong một SWF được tải vào một cấp độ là một quá trình đơn giản: số lượng đầu vào cấp độ của các SWF chứa các clip phim, theo sau là tên dụ chính nó. Một ví dụ được gọi là cuteDog_mc trong một SWF được nạp vào Cấp 42
Nội dung trích xuất từ tài liệu:
Targeting Movie Clip Instances on Levels < Day Day Up >Targeting Movie Clip Instances on LevelsTargeting a movie clip instance that exists within an SWF loaded into a level is astraightforward process: input the level number of the SWF that holds the movie clip,followed by the instance name itself. An instance called cuteDog_mc within an SWFloaded on Level 42, for example, would have this target path (relative to movies on otherlevels):_level42.cuteDog_mcIf cuteDog_mc itself contained a movie clip instance named tail_mc, that instances targetpath would be:_level42.cuteDog_mc.tail_mcAlthough weve used absolute paths in these examples (because were targeting timelineson different levels), remember that you can use relative target paths to target timelines onthe same level.In this exercise, well build on our operating system project by targeting movie clipinstances in SWFs loaded into levels, and well show you how to use simple data fromone level in another. 1. Open levelTarget3.fla in the Lesson03/Assets folder. This is like the file to which we added scripts in the last exercise, with one addition: the timeline now includes a layer called Colors Clip.2. Press the Show Layer button (with the big red X) on the Colors Clip layer to reveal the content of this layer. You should now see a purple box that covers the entire stage. This box is a movie clip instance named colors_mc. This movie clip instance will act as a color layer above the multicolored textured background you see when this instance is not visible. Changing the color and transparency of this instance will make it seem as if the textured background on the desktop is changing. Soon well script the movie thats loaded into Level 1 (backgroundControl.swf) to change colors and control transparency of this instance.3. Double-click the colors_mc movie clip instance to edit it in place. The timeline of the colors_mc movie clip instance is composed of a single layer that contains several frame labels. At each of these frame labels, the colored box on stage is filled with the color associated with that frame labels name. We will control this clips color by sending it to different labels on its timeline. Initially the clip will be purple because this is the color at Frame 1, and that frame includes a stop() action to prevent the timeline from moving until we instruct it to do so.4. Return to the main timeline. With the Property Inspector open, select the text field in the lower-left portion of the stage, next to where Enter Text: is displayed. Looking at the Property Inspector, youll notice that this is an input text field named inputText_txt. Here the user can enter any text he or she wants, and that text will be displayed in a text field in the movie loaded into Level 2 (textBox.swf). Next, well set up the script that creates this functionality.5. With the Actions panel open, select the button on the desktop that resembles a scroll of paper, and add this script just below _level2._visible = true;:6.7. _level2.inputText_txt.text = _level0.inputText_txt.text;8. A text field named inputText_txt in the movie that gets loaded into Level 2 has the same name as the text field in this movie, as we discussed in the preceding step. When this button is pressed, this action will set the value of the text field on Level 2 to the same value as the text field in this movie. This is a simple example of how data can be transferred between timelines.6. With the Actions panel open, select Frame 1 of the main timeline and add this script just below loadMovieNum (textBox.swf, 2);:7.8. _level0.colors_mc._alpha = 50;9. This action will make the colors_mc movie clip instance (which resides on the Colors Clip layer) 50 percent transparent when the movie begins to play. We used a target path of _level0 for this action—even though its not required—to reinforce your understanding that the first movie to load (this movie) is automatically loaded into Level 0.7. Export this file as levelTarget.swf in the Lesson03/Assets folder. Well play this file at the end of this exercise.8. Save this file as levelTarget4.fla. Were finished scripting this file.9. Open backgroundControl2.fla in the Lesson03/Assets folder. This is the same file we used in the last exercise—the one that gets loaded into Level 1 of our project. In the previous exercise, we scripted it to become invisible on loading, to close when the Exit button is pressed, and to become draggable when the invisible button at the top of the box is pressed. Here, well enhance its functionality by enabling it to control the colors_mc movie clip instance that resides on Level 0. Well attach scripts to the many square buttons that you see. Before we begin scripting, you need to familiarize yourself with several of the elements on the stage. On the left, just below the word Transparency, youll see a dynamic text field named alphaAmount_txt. You will use it in two ways: to display the current transparency of the colors_mc movie clip instance on Level 0, and to display the amount of transparency that will be applied to that instance when any of the five Transparency buttons are rolled over. To the left of this text field of the five Transparency buttons are rolled over. To the left of this text field are five square buttons that will be scripted to change the transparency of the colors_mc movie clip instance. Below these buttons are nine additional buttons that resemble color swatches. These buttons will be set up to send the colors_mc movie clip (Level 0) to the various frame labels on its own timeline. Below these buttons is a movie clip instance named currentColor_mc, which is essentially a ...

Tài liệu được xem nhiều: