Flash Tip: Some notes on the name of a movie clip instance

Source: Internet
Author: User
Skills

If a movie clip instance does not have a named instance name at the beginning, and a later frame names the instance name. Then the movie clip will always use the system default instance name from the first frame to the end of the movie: Instancexx,xx is not duplicated.

If a movie clip is named after the frame from which it appears, then the instance name will be used until the new instance name is given to him.

If an instance of a movie clip (instance name is MY_MC) appears in Nth frame, the movie clip is copied in the N+1 frame, or the same movie clip is dragged from the library. Also, the instance names of these two movie clips are named My_mc, and the movie clips that were first dragged into the scene at design time will become real MY_MC instances.

Another movie clip, although _name is also MY_MC, is not a reflection of this statement

My_mc._alpha = 50;

Because it only has effect on the real my_mc of the first appearance in the design.

If you remove the instance name of the true MY_MC instance of "just become transparent". The effect is still the same because, I just said, "If a movie clip is named after the frame from which it appears, then the instance name will be used until the new instance name is given to him." Because there is no new name to replace, he will always use MY_MC this instance name. and "copied", or "later dragged from the library to the scene" of the instance name is also MY_MC movie clips, he is not always "just become transparent" my_mc "authentic."

Look at the statement below:

For (i in _root) {
if (_root[i]._name = = "My_mc") {
Trace (_root[i]._alpha);
}
}

The output is:
100
100
It's easy to understand, thinking that their _name are all MY_MC. We use this property to mark the instance names of several of the instances in the scene that require an output attribute, and then use for (i in _root) {} to select the output.

Then look at the following code:

For (i in _root) {
if (_root[i]._name = = "My_mc") {
_root[i]._alpha = 0;
}
}

You must think that all the movie clips named MY_MC will become transparent, but only the original MY_MC become transparent. It is not possible to change the properties of a movie clip with the same instance name at the same time, regardless of whether the loop is used.

If you drag a few instances of the movie clip named "A" on the scene, and a few movie clips with the instance name not set (they will use the system default instance name when they run)

Use the following code:

For (i in _root) {
if (_root[i]._name!= "MY_MC") {
_root[i]._alpha = 0;
}
}

You will find:

The instance named a is "not transparent", the instance name is MY_MC "not transparent," and "becomes transparent" with no duplicate instance name or without setting the instance name.

To summarize, a movie clip with the same instance name is not recommended in general. Because you can only get their properties, you cannot change their properties. Flash does not limit your use of the same instance name, it should be so that you use for (i in _root), it is convenient for you to have some instances of the same instance name "excluded." Instead of setting, changing all instances of the same instance name.

The nature of the inside also want to personally try, experience experience.

The above content copyright belongs to Wizim all, because my level is limited, unavoidably has the mistake place, welcome the discussion.



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.