如何从ActionScript中具有相同名称的类引用Global类?

tyl*_*ler 0 apache-flex actionscript-3

由于我无法控制的要求(不要问,这太荒谬了)我需要创建一个名为'Math'的AS3类,它引用Global AS Math类.所以,例如:

package my.package
{
    public class Math
    {
        public static function pow( a:Number, b:Number ):Number {
            // How do I call the Global.as$Math#pow(..) function?
            return Math.pow(a,b);  
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

上面的代码显然是错误的 - 导致无限递归.我不知道怎么说我想委托给Global.as $ Math课而不是这个Math课......

我当前的尴尬解决方案是委托另一个传递给Global Math类的类(不是名为Math).有一个更好的方法吗?

谢谢!

aku*_*ser 7

在阅读Josh Tynjala的帖子后,这是另一种突然出现在我的脑海中的方式,关于动作脚本中的包只是名称空间上的抽象层:

public class Math
{
        namespace globalNs = "";  
        public static function pow( a:Number, b:Number ):Number 
        {
            return globalNs::Math.pow(a, b);  
        }

}
Run Code Online (Sandbox Code Playgroud)

globalNs :: Math.pow显式引用顶级Math类.