Dunno about as3.. but what about the old _target property? :)
----- Original Message -----
From: "quinrou ." <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, July 26, 2007 12:06 PM
Subject: Re: [Flashcoders] AS3 - how do i find the path to where a MC
belongs?
yeah eka that seems to be a good solution but a bit resourceful depending
how deep the nested mcs are.
Surely there must be a native property or medoth to find the tree/path
from
the mc to the stage...
This is driving mad...
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
_______________________________________________
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