Use setchildindex () to set the layer depth of the display object

Source: Internet
Author: User

The setchildindex method allows you to move the position of the display object in the display list up or down. You can consider the display list as an array. Its Index position starts from Layer 3. If you create three display objects, they are located at Layer 0, 1 and 2. The second layer objects are outside, and the second layer objects are in the innermost layer.
If you want to move a video clip to the innermost layer of all display objects, you can use setchildindex (mymovieclip, 0) to execute this statement, and the remaining objects will be automatically upgraded to a layer, and their index locations are added with 1, the original 0th layer elements moved to the 1st layer, the 1st layer elements moved to the 2nd layer ......
If you want to move a display object to the top of all objects, you need to use the numchildren attribute, which means the number of objects displayed in the container. For example, a container now has three display objects. The value of numchildren is 3, and the Level list is Layer 1 and Layer 2, respectively. The depth of the outermost layer is the numChildren-1 layer. Setchildrenindex (mymovieclip, numChildren-1)

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.