mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 17:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,96 @@
|
||||
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 = "4.5.1.21328";
|
||||
|
||||
private static var counter:int = 0;
|
||||
|
||||
public function NameUtil()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function createUniqueName(object:Object) : String
|
||||
{
|
||||
if(!object)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var name:String = getQualifiedClassName(object);
|
||||
var index:int = name.indexOf("::");
|
||||
if(index != -1)
|
||||
{
|
||||
name = name.substr(index + 2);
|
||||
}
|
||||
var charCode:int = name.charCodeAt(name.length - 1);
|
||||
if(charCode >= 48 && charCode <= 57)
|
||||
{
|
||||
name += "_";
|
||||
}
|
||||
return name + counter++;
|
||||
}
|
||||
|
||||
public static function displayObjectToString(displayObject:DisplayObject) : String
|
||||
{
|
||||
var result:String = null;
|
||||
var o:DisplayObject = null;
|
||||
var s:String = null;
|
||||
var indices:Array = null;
|
||||
try
|
||||
{
|
||||
o = displayObject;
|
||||
while(o != null)
|
||||
{
|
||||
if(Boolean(o.parent) && Boolean(o.stage) && o.parent == o.stage)
|
||||
{
|
||||
break;
|
||||
}
|
||||
s = "id" in o && Boolean(o["id"]) ? o["id"] : o.name;
|
||||
if(o is IRepeaterClient)
|
||||
{
|
||||
indices = IRepeaterClient(o).instanceIndices;
|
||||
if(Boolean(indices))
|
||||
{
|
||||
s += "[" + indices.join("][") + "]";
|
||||
}
|
||||
}
|
||||
result = result == null ? s : s + "." + result;
|
||||
o = o.parent;
|
||||
}
|
||||
}
|
||||
catch(e:SecurityError)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static function getUnqualifiedClassName(object:Object) : String
|
||||
{
|
||||
var name:String = null;
|
||||
if(object is String)
|
||||
{
|
||||
name = object as String;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = getQualifiedClassName(object);
|
||||
}
|
||||
var index:int = name.indexOf("::");
|
||||
if(index != -1)
|
||||
{
|
||||
name = name.substr(index + 2);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user