I also want to learn how to write a tutorial: lol. I hope it will help you. If you find any problems, please correct them! First, let's talk about the practices of projects (such as music videos) with content on the stage in the main scenario: Someone asked if it was a new loader and then loader. load (this), in fact, is not so troublesome, very simple, written in the document class constructor: loaderinfo. addeventlistener (progressevent. progress, your processing function). Write the processing function as follows: Function your processing function (E: progressevent ){ Trace (E. bytesloaded/E. bytestotal ); } That's all. Easy! In addition, the interface code separation project (the main stage content is generated by the: This error is prone to errors. The common error is the same as the above MV loading. The result is that loading is 100%, The reason is that there is usually only one frame in the main timeline of the Project separated from the interface code. Flash exports the first frame by default, and then calls the constructor of the document class, that is to say, the Progress event listening takes effect only after loading is complete. Of course, no progress is displayed! Solution 1: double file method (for the code, see reply). This method is actually bypassed: Create loader. As, create loader. fla, and set loader as a document class. Create main. As, create main. fla, and set main as the document class. In loader. A new loader instance is loaderand loaded into main.swf with LoadRunner. Add progress and complete listeners on loader. contentloaderinfo Update textfield in the Progress processing function, and add loader. content to the stage in the complete processing function. In Main. Build stage content Solution 2: The dual-frame method is the real solution: But there is a small regret that the main timeline is two frames, but it is already good. Create loader. As and the FLA file to ensure that the master axis has two frames and both are key frames. In FLA: Create an empty Mc and drag the MC to the second frame of the main scenario.
Double-click to edit the empty component, change the timeline of the component to two key frames, enter the second frame, and drag all components linked to the class in the library to the stage.
Cancel "export at the first frame" in the Link property of all components linked to the class:
In loader. Create a textfield and push it to the stage. The constructor adds the SS and complete listener to loaderinfo. Update textfield in the Progress processing function, and add enter_frame listening in the complete processing function. Construct the stage content in the enter_frame handler and remove the enter_frame listener. That is to say, you can execute the enter_frame handler once. [This post was last edited by Andy-Tang] |