http://www.kirupa.com/forum/showthread.php?p=1935107


On 7/24/07, eka <[EMAIL PROTECTED]> wrote:

Hello :)

in AS3 i don't find a native method ?

For the moment you can test :

package
{

    import flash.display.* ;

    public class test extends Sprite
    {

        /**
         * Creates a new test instance.
         */
        public function test()
        {

            var container:Sprite = new Sprite() ;

            var container2:Sprite = new Sprite() ;
            container2.graphics.beginFill(0xFF0000, 1) ;
            container2.graphics.drawCircle(0, 0, 150) ;

            addChild(container) ;
            container.addChild(container2) ;

            var target:String = getDisplayPathName(container2) ;

            trace( target ) ;

        }

        static public function getDisplayPathName( display:DisplayObject
):String
        {

            var parents:Array = [] ;
            var parent:* = display ;

            while( true )
            {
                parents.push( parent.name ) ;
                parent = parent.parent ;
                if (parent.name == null)
                {
                    break ;
                }
            }

            parents.reverse() ;

            return parents.join( "." ) ;

        }

}

but it's not the better solution lol

eKA+ :)

2007/7/24, quinrou . <[EMAIL PROTECTED]>:
>
> Hi all,
>
> I am wondering how can I manage to find the path to where a MC belongs?
>
> in AS2 when you wanted the target to where the MC was all you had to do
> was
> to trace the movieclip instance. For instance cosider the following
> example:
>
> var mc:MovieClip = this.attachMovie("something" , "something0" , 0);
> var mc = mc.something0.attachMovie("somethingelse" , "somethingelse0" ,
> 0);
> trace(mc) // _level0.something0.somethingelse0
>
>
> In AS3 since everything is a class everytime I trace an object i get its
> class name.
>
> So is there anyway of know the tree to where a mc belongs?
>
> thanks
> seb
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to