Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6839205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:41:26+00:00 2026-05-26T23:41:26+00:00

Is there any method with which I can get to know which of the

  • 0

Is there any method with which I can get to know which of the two movieclips I’m using is lying above or below in the timeline ‘layer’ arrangement in flash.

what I’m asking is if have two movieclips ‘a’ and ‘b’. One in layer 10 of timeline of flash professional and ‘b’ on layer 1. Will be able to change the index order using pure as3 code to visually keep the movieclip on the 10th layer on top of the movieclip on 1st layer??

Thank you.
Vishnu

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:41:27+00:00Added an answer on May 26, 2026 at 11:41 pm

    [[Edit]]

    The attached method will not work if both target objects are leaf nodes in a shared parent.


    The timeline children are always under whatever actionscript generated children are associated to the timeline class.

    e.g.

    If you have timeline X, which extends ClassA, and in Class A, you add children E, F, G, but timeline X contains layers B, C, D, each with a single symbol in each layer, with layer B at the bottom of the timeline, the following would be observed:

    child 5: G
    child 4: F
    child 3: E
    child 2: D
    child 1: C
    child 0: B
    

    To expand on a felipemaia’s answer, I’ve devised the following method to determine which movie clip lies absolutely above the other. This has not been thoroughly tested, but should operate as a baseline for your development.

    function selectAbove(obj1:DisplayObject, obj2:DisplayObject):DisplayObject
    {
    
        var obj1_parentCount:int = parentCount(obj1);
        var obj2_parentCount:int = parentCount(obj2);
    
        var target:DisplayObject;
        var other:DisplayObject;
    
        if (obj1_parentCount > obj2_parentCount)
        {
            target = obj1;
            other = obj2;
        }
        else
        {
            target = obj2;
            other = obj1;
        }
    
        var container:DisplayObjectContainer =
            (target is DisplayObjectContainer) ? target as DisplayObjectContainer : target.parent ;
    
        var container_last:DisplayObjectContainer;
    
        var sharedParent:DisplayObjectContainer;
    
        while(container)
        {
            if(container.contains(other))
            {
                sharedParent = container;
                break;
            }
    
            container_last = container;
            container = container.parent;
        }
    
        if(!sharedParent)
        {
            throw new Error("An object does not maintain its parent in the display heirarchy!");
        }
    
        var ret:DisplayObject;
    
        if(container == other)
        {
            ret = target;
        }
    
        return container != other ?
            container.getChildIndex(container_last) < container.getChildIndex(other) ?
                other :
                target
            :
            target
        ;
    }
    
    function parentCount(obj:DisplayObject):int
    {
        var ret:int = 0;
    
        while(obj)
        {
            ret++;
            obj = obj.parent;
        }
    
        return ret;
    }
    

    This method will work for nested display hierarchies. I have not tested this 100%, but initial cases completed as expected.

    Best of luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any method I can get the full JSON data from jqGrid when
I am very new to PHP and MySql. Is there any method by which
I'm using the Perl mod XML::SemanticDiff which can compare two XML documents. I want
I know that we can get the current location of Android device using getLastKnownLocation
Is there any general method or particular methods for different numbers through which we
I'm trying to find out if there are any methods in Java which would
Is there any method to rename a div element. I have a div with
Is there any method / API defined to collect system info in osx. I
Is there any method available to add IDs like there is for adding a
Is there any method to preview Excel files on XP besides WebBrowser control? How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.