package org.zf.util
{
import flash.utils.getQualifiedClassName;
/
// CopyRight (c) 2011, Zeng Feng all rights reserved
// Autor: Zeng Feng (zengfeng75@163.com)
/
/**
* 类工具
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion ZF 1.0
* */
public class ClassUtil
{
/**
* 取得对像类完成名称
* 如:flash.display::MovieClip
*
* @default null
*
* @see #getSimpleClassName()
* @see flash.utils.getQualifiedClassName
*
* @param object:Object 一个对像 默认Null
* @return 一个字符串
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion ZF 1.0
* */
public static function getClassName(object:Object):String
{
var name:String;
if (object is String)
name = object as String;
else
name = getQualifiedClassName(object);
return name;
}
/**
* 取得对像类简单纯名称
* 如:MovieClip
*
* @default null
*
* @see #getClassName()
* @see flash.utils.getQualifiedClassName
*
* @param object:Object 一个对像
* @return 一个字符串
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion ZF 1.0
* */
public static function getSimpleClassName(object:Object):String
{
var name:String;
if (object is String)
name = object as String;
else
name = getQualifiedClassName(object);
// If there is a package name, strip it off.
var index:int = name.indexOf("::");
if (index != -1)
name = name.substr(index + 2);
return name;
}
}
}
一个ActionScript3.0的类工具ClassUtil
最新推荐文章于 2021-02-21 11:10:00 发布