Flash as learning: Explaining the problem of movie Clip Depth (depth)

Source: Internet
Author: User
Tags copy
Question everybody to duplicatemovieclip () should not be unfamiliar with it, it is used to copy MC. The Duplicatemovieclip () has a parameter----Depth, which is used to control the depth of the newly copied MC, the larger the number, the higher the top level.
As an example:
There are 1 MC1 on the stage, written on the frame
Mc1.duplicatemovieclip ("MC2", 2);
Mc1.duplicatemovieclip ("MC3", 20);
Plus these words, in order to make the copied MC2 MC3 not overlap together
Mc2._x + 25;
Mc3._x + 50;
Mc2._y + 50;
Mc3._y + 100;
The following figure: Mc3 on MC2, MC2 on MC1

Let's talk about the numbers that decide depth
Novice may have faced this problem, according to the position of the layer, the original MC is covered by other graphics, but the new copy of the MC is always covered with any of the graphics on any layer of the timeline. No matter how small or even negative the depth number is, the newly copied MC is always on top of all the graphs on any layer in the timeline, as shown below:

The Red MC covers the blue, the depth of the newly copied MC is negative.

The new copy is still covered in red.
Flash depth is divided into 3 regions:
Timeline Area ( -16384~-1)
Mainly used to place the Flash IDE editor image, MC, etc., this area of the MC can not be deleted with AS, but can be used as dynamic creation of the MC here.
Dynamic Area (0~1048575)
Allows you to dynamically create or delete an MC using as as when executing.
Reserved area (1048576~2130690045)
The MC can be created dynamically with as as is allowed, but cannot be deleted after it is created. An MC that exceeds the depth of 2130690045 cannot be created with Duplicatemovieclip () or Attachmovie ().
Because the time axis and the retention area of the MC can not be deleted dynamically, if you want to delete, you may use swapdepths () to switch to the dynamic area before deletion.
★ Control the depth of the MC method
There are 3 ways to make the newly copied MC under red.
1) Flash6 support a getdepth () of the instructions, you can know the depth of MC, the first red MC named Red, Blue named MC1, written on the frame:

Trace ("MC1 Depth:" +mc1.getdepth ());
Trace ("Red depth:" +red.getdepth ());

Press CTRL + ENTER to test the film, and their depth turns out to be:

MC1 depth:-16383
Red depth:-16380

Now know is good to do, as long as duplicatemovieclip () depth set in the -16383~-16380 between the newly copied MC put in the red, such as write:

Mc1.duplicatemovieclip ("MC2",-16382);
Mc1.duplicatemovieclip ("MC3",-16381);

Test results:


The newly copied MC is under the Red MC ...
If the depth is set very small, can the newly copied MC be under all the graphics? This is not because -1638* is the lowest number supported by depth in Flash, it is impossible for MC to be low, for example:

Mc1.duplicatemovieclip ("MC2",-20000);
Mc1.duplicatemovieclip ("MC3",-30000);

Two new MC will not produce .....
Quack, first write to here, these days like reading, while watching and share with you ...



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.