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

  • Home
  • SEARCH
  • 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 5991905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:27:19+00:00 2026-05-22T23:27:19+00:00

In Actionscript 3 is there any way to determine the precise display object hierarchy

  • 0

In Actionscript 3 is there any way to determine the precise display object hierarchy an event will traverse through when dispatched from a given object? The object is not necessarily a display object.

Although I could imagine this actually being useful somehow, in my particular case it is a learning exercise. I’m trying to master the event system in flash and have some locations where I’m very curious what path an event will take when I dispatch it.

  • 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-22T23:27:20+00:00Added an answer on May 22, 2026 at 11:27 pm

    The answer is sort of. Events aren’t limited to DisplayObjects, and when they are triggered by DisplayObjects, they don’t always follow the same pattern — the Event may very based on what type of DisplayObject and whether the event was triggered programmatically (through dispatchEvent) or natively (by a mouseClick). It may also vary based on whether bubbling is enabled or not and if it is a custom event. A Loader’s complete event, for example, does not make sense to propagate to parent objects, even though Loader is a display object.

    If you’re trying to figure out the parents of the object which dispatched an event, then you’ll want something like this:

    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.display.DisplayObject;
    import flash.display.DisplayObjectContainer;
    myDispatcher.addEventListener( MouseEvent.CLICK, clickHandler );
    
    function clickHandler( event:MouseEvent ):void
    {
        // event.currentTarget is the object which you're listening to.
        // event.target is the object which actually dispatched the event
        // (if you're listening to a MovieClip and a button inside it is clicked,
        // target will refer to the button, currentTarget the MovieClip)
        var ancestry:Vector.<DisplayObjectContainer> = getAncestry( event.currentTarget as DisplayObject );
        // do somethign with all of the parents.
    
    }
    
    // this function takes a DisplayObject and returns all of its ancestor objects 
    // all the way to the root as a Vector.
    function getAncestry( obj:DisplayObject ):Vector.<DisplayObjectContainer>
    {
        var par:Object = obj.parent;
        var ancestry:Vector.<DisplayObjectContainer> = new Vector.<DisplayObjectContainer>();
        while( par )
        {
            par = par.parent;
            ancestry.push( par as DisplayObject );
            if( par == root ) break;//sometimes the root has a parent.
        }
        return ancestry;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to call from javascript to actionscript, not using JSON object.
Is there any way to have a binary compiled from an ActionScript 3 project
Is there any way to resize an entire Flash project using Actionscript or some
Is there any way to create foldable regions of code in ActionScript 3 (read
Is there any way to detect memory leaks in Flash ActionScript-3 project? what are
Is there any way to halt execution in ActionScript, such as a sleep() method?
Is there any way I can expose a C++ object/function to JavaScript running inside
Is there any opensource flash/actionscript code to display an image for x number of
Any list of Testing frameworks for ActionScript 2.0/3.0 around there?
First is there any technique for using Action Script for recording sound from microphone?

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.