Flash makes the title load loading method

Source: Internet
Author: User
Tags setinterval

To be an excellent loading is to measure a flasher level, even an attitude, because loading is the only one you will not look at and all the users, customers will see, so you pay more attention to loading, you can even contrast this flasher professional ethics.

I know a lot of design-oriented friends, many of them are looking for a ready-made loading, and then each to apply. Personally, I think it's a bad habit. Not that I do not advocate the reuse of code, components, but I think for loading this kind of thing, more than a problem. I strongly recommend that those who have reached the level of loading can be modified flasher look at my things.

The discussion is divided into three parts:

1. Basic

2, Moviecliploader related discussions (more in-depth)

3, V2 components related issues

Today we mainly introduce the basis of the loading production of flash.

The first thing to be thankful for is the great wisdom of Macromedia, which provides a good two functions so that we can make the perfect loading, that is getbytesloaded and getbytestotal. Please do not use you change to change for two or three years of that what getframeloaded what, I can not remember how to spell. I just want to say that the idea of frame will fade in real interactive-design. Let alone what scene, that is Flash's failure!

So how does loading work? How do we use these two functions? There is an important concept to be mentioned here. is the interval call. Interval calls are in many ways, listed below, and enumerate their status and usage in loading production, welcome to add:

SetInterval Way

Writing:

function Loadcheck ()

{

var p = getbytesloaded ()/getbytestotal ();

if (p==1)

{

Clearinterval (Intervalid); Free interval Call

gotoAndPlay (Someframe); Start playing

}

}

var interval = 30; This number is the refresh rate.

var intervalid = setinterval (loadcheck,interval);

I personally do not recommend this for beginners. Because many people tend to ignore clearinterval, and this thing is ignored, is very scary! If your setinterval is not removed in time, it means you will add an unnecessary burden to the entire SWF playback process! And this method is not suitable to control the situation of moiveclip (because beginners will find that the MC path is a big problem, and Loadcheck itself is a function, or is called by the setinterval, to the middle finger in loadcheck a path out, very troublesome, you do not expect _root, that will make your program not standard, and do not expect this, because it seems not ideal to use this in the function, it is best not to write, but often you dare not write, and then make better results.

Onenterframe Way

That's the way I like it best. More convenient and intuitive. Because often we are to use an MC to embody a loading progress, for example, a progress bar, or more creative things, only you can not think of, there is no you can not do.

So how to use it. First, set your ideas right. Then give your MC an instance name, like called LOADER_MC. This is the time to write code on the timeline, remember, is timeline rather than MC. Because it is easy to unify the code, convenient path unification, easy to manage and find. Don't move the code all the way to BUTTON,MC to save a few letters, and then one on (press). Unless you are working on your work, or you are trying to hand in your homework.

Loader_mc.onenterframe = function ()

{

var gettar:movieclip = this._parent;

var p = gettar.getbytesloaded ()/gettar.getbytestotal ();

Trace (P);

if (p==1)

{

This.onenterframe = null;

Delete This.onenterframe; Note that the delete

gotoAndPlay (Someframe); Start playing

}}

It's so simple to remember that it's always a quick thing to refer to MC inside the MC's event function body. Because this can point to the MC itself, through methods such as this._parent, you can find all your mc!

A circular approach directly dependent on timeline

This is a very, very, very old way, it is not much introduced.

The above is relatively simple. There are also two loading technologies that are more prone to problems, namely the loader of Moviecliploader, which contains a variety of V2 components. We'll go on to the next section.

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.