Flash special effects production: perfect loding production

Source: Internet
Author: User
Tags copy variable
Effects

Of course, the "perfect loding" refers to the internal effect of the Londing program rather than the outward appearance. Not much to say, this post is I specifically for the rookie and wrote, although the introduction of the "Londing program" has more than one article, but there are many novice to "londing program" or have a lot of questions, especially for their own "londing" why always on the screen flashed , some can not even see "londing", of course, this was also a question of my own. Now I would like you to introduce a "double load + visual loading (which can see the process of londing program loading)" in the main movie, which is a perfect londing program for one frame.

First, we press CTRL+F8 to create a new movie clip called "londing," preferably by selecting "Center on It" on its way. At this point, we start making the "londing" action, entering the following code at the first frame of the first layer (called action):

_parent.stop ()//The current movie's parent movie clip, stop playing
var fa;//declared local variable FA
var fb;//declare local variable FB
var fc;//declared local variable FC
FC = 0;//to give the variable FC a value of "0"
var ga;//ibid declaration local variable GA
var gb;//variable GB
VAR gc;//variable gc
GC = 0;//give the variable gc a value of "0"
This.onenterframe = function () {
};//the current object (the above variable), starts the call when it enters the frame, declares the defined function again

(Copy the above code to the first frame)

Program Explanation: The main function of the above code is to let the movie know our defined function, when the movie enters the current clip "londing" to use. The next step is to enter the main code for the Londing program, click the action layer to press F5, and enter the following code in the new frame:

FA = _parent._framesloaded;//The variable FA to the value _framesloaded (number of frames that the movie has loaded)
FB = _parent._totalframes;//make variable fb assign value _totalframes (total number of frames)
FC = Fc+math.round ((FA/FB*100-FC)/10000000000000000000000000+1);//Get a percentage of the number of frames loaded in the movie
Tiao1._xscale = (FC);///To scale the width of the tiao1 by the percentage of the number of frames loaded
Text2 = "Prepare to load Movie bytes ..."//text in dynamic text basket showing "..."
Text1 = "Load movie frame ... "+ (FC) +"% ";//To display the percentage of frames loaded in Text1 and add a% to the back
if (fc>=100) {//If the percentage of the movie loaded frames reaches 100%, start the following code
Text1 = "Finish";//Show "Finish" in dynamic text Text1
GA = _parent.getbytesloaded ()/////Make variable GA getbytesloaded () (number of bytes loaded by the movie)
GB = _parent.getbytestotal ()///////() () () Getbytestotal () () (total bytes of the movie)
GC = Gc+math.round ((GA/GB*100-GC)/10000000000000000000000000+1);//Get a percentage of the number of bytes loaded in the movie
Tiao2._xscale = (GC);//To scale the width of the Tiao2 by the percentage of the bytes added
Text2 = "Load Movie bytes ..." + (GC) + "%";//Add the percentage of bytes to the Text2 and add a% below
if (gc>=100) {//If the percentage of the movie plus bytes reaches 100%, start the following code
_root.gotoandstop (2); Move the previous movie to frame 2nd and stop playing the movie
This.stop () to stop the movie from playing at the current level
}
}

Program Explanation: Londing program is made in two ways, one is frame loading the second is the movie byte loading, in the above code has been introduced very clearly. The above program has already fused both ways of loading, so I can boldly say that it is the perfect londing program. After the movie frame is loaded, start loading the number of bytes in the movie. The "if (condition) {Execute code}" in the code above is a conditional statement that starts executing another piece of code after a condition is met, such as if (FC>=100) the number of loaded frames reaches 100%. The main purpose is to make the two pieces of code can be executed separately, if the "if (condition) {Execute code}" flash will let two pieces of code execute at the same time.

Also, some beginners are not very clear about the use of "_root and this", so it is necessary to mention their usage and significance here. If you add "on" {_root.gotoandstop (5)} to a button in a component, it means to go to frame 5th and stop when the button is clicked (the top level). If you add "on" {This.gotoandstop (5)} to a button in a component, control the button in the current-level movie clip. Another sentence, flexible use of "_root and this", will allow themselves to better control the film.

To complete the last step of the action layer, let's click the layer again and press F5. Add code to the third frame of the action layer:

gotoAndPlay (2);

OK, now it's time to start making the visual part of the Londing program.

Creates a new layer, named text. Create a new two dynamic text basket in the text layer with the font size set to 14. Set the variable to "Text1" width to 153 in the property of a text basket, and set the variable to "text2" width to 153 in another dynamic text basket. In the click on the "vertical to it" and then a new layer, named Fill basket. In this layer, select "Moment Tool (R)", the Stroke color is black (optional) Fill color yellow (optional) Drag out two moments, width is 150 high 12. Make "Text1" and a moment of the level of it, so that "Text2" and another moment of the level of its. Click the color area in the two-moment type to convert the movie clip to left, and the moment instance in the "Text1" level is named "Tiao1", and the moment instance in the "Text2" level is named "Tiao2".

Finally, the made londing clips are dragged out of the library and placed in any position in the main scene. Okay now the Londing program can be said to have been completed, but in the Ctrl+enter test you will find that in the two Tiao zoom on a number of problems, such as the figure, of course, the solution is also very simple.

To illustrate, I am in the production of the moment is the outer basket and tiao layered, tiao1 and Tiao2 also divided the layer, this is to make more convenient to produce tiao. Now we set the width of the Tiao2 property to 1.0, with the TIAO2 outer basket on the leftmost side of it.

A new layer, called a mask. Copy instance Tiao2, paste to mask layer, select Paste to current position. Right-click the matte layer and select the mask Layer in the right-click menu. Okay, now that the londing program has been workpiece, when you test again, all the problems have been solved.

Of course, if you think that a step-by-step production is a bit of a hassle, you only need to copy the first frame of the Lond layer in the original program (FLA) file to the first frame of your movie. Note: This method can be applied to any movie.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.