« Functionの呼び出し元(caller)のスコープを調べる | メイン | Flash8でコマンドパネルを作るとき »

2007年8月30日

[as3] ムービークリップの階層を出力

AS2だと
trace(this);
だけで済むのに、AS3でこれをしようとすると
function getGlobalPath( target:DisplayObject ):String
{
  if( target!=target.root ){
    var _path:String = getGlobalPath( target.parent );
    return _path+"."+target.name;
  } else {
    return "root";
  }
}

var res:String = getGlobalPath( this );
trace(res); //出力 : root.instance1.instance2.instance3.instance4.instance5
var mc:Object = this.root;
trace( mc.instance1.instance2.instance3.instance4.instance5==this ); //出力 : true
いちいちこんな事しないといけないのかな?

投稿者 michi : 2007年8月30日 15:10

« Functionの呼び出し元(caller)のスコープを調べる | メイン | Flash8でコマンドパネルを作るとき »

トラックバック

このエントリーのトラックバックURL:
http://system.seyself.com/mt-tb.cgi/105

コメント

コメントしてください




保存しますか?