有没有一种方法来获取路径到MovieClip我点击?
Is there a way to get the path to the movieClip I'm clicking?
例如。 event.currentTarget.path? (这不工作,但我想类似的东西!)
e.g. event.currentTarget.path? (This doesn't work but I'd like something like it!)
感谢
所以,你想通过名称来获得路径:]
So You like to gain path by names :]
在这里你有工作版本,我写的唯一的想法了。
Here You have working version , before i write only idea .
stage.addEventListener(MouseEvent.MOUSE_DOWN , mouseHandler);
public function mouseHandler(e:MouseEvent):void {
var object:DisplayObject = e.target as DisplayObject;
var path:String = object.name ;
while(object != e.target.root){
object = object.parent;
path = object.name + "." + path;
trace(object);
};
trace("stage."+path);
};
要使用该功能获取的DisplayObject通过路径IM:链接到GitHub上
To get DisplayObject by path im using this function : link to github