home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Puzzle
/
filler.swf
/
scripts
/
mx
/
utils
/
NameUtil.as
< prev
next >
Wrap
Text File
|
2008-09-02
|
2KB
|
73 lines
package mx.utils
{
import flash.display.DisplayObject;
import flash.utils.getQualifiedClassName;
import mx.core.IRepeaterClient;
import mx.core.mx_internal;
use namespace mx_internal;
public class NameUtil
{
mx_internal static const VERSION:String = "2.0.1.0";
private static var counter:int = 0;
public function NameUtil()
{
super();
}
public static function displayObjectToString(param1:DisplayObject) : String
{
var _loc2_:String = null;
var _loc3_:DisplayObject = null;
var _loc4_:String = null;
var _loc5_:Array = null;
_loc3_ = param1;
while(_loc3_ != null)
{
if(_loc3_.parent && _loc3_.stage && _loc3_.parent == _loc3_.stage)
{
break;
}
_loc4_ = _loc3_.name;
if(_loc3_ is IRepeaterClient)
{
if(_loc5_ = IRepeaterClient(_loc3_).instanceIndices)
{
_loc4_ += "[" + _loc5_.join("][") + "]";
}
}
_loc2_ = _loc2_ == null ? _loc4_ : _loc4_ + "." + _loc2_;
_loc3_ = _loc3_.parent;
}
return _loc2_;
}
public static function createUniqueName(param1:Object) : String
{
var _loc2_:* = null;
var _loc3_:int = 0;
var _loc4_:int = 0;
if(!param1)
{
return null;
}
_loc2_ = getQualifiedClassName(param1);
_loc3_ = _loc2_.indexOf("::");
if(_loc3_ != -1)
{
_loc2_ = _loc2_.substr(_loc3_ + 2);
}
if((_loc4_ = _loc2_.charCodeAt(_loc2_.length - 1)) >= 48 && _loc4_ <= 57)
{
_loc2_ += "_";
}
return _loc2_ + counter++;
}
}
}