在项目中发现:
1、MapView.as
public static function registerParent(parent:DisplayObjectContainer,isShow:Boolean=false):void{
parent.addChild(instance);
instance.visible=isShow;
}
2、MainGame.as
MapView.registerParent(this);//直接使用类名加方法,不通过对象
********************************************************************************
解释:一般使用static函数的类都基本上是想记录类对象被引用的次数或者这个函数地址需要被外部使用, 类似回调。 static函数在内存区域中是在全局函数区, 而普通成员函数则是在代码区的累对象区域中。 因此调用static函数时只需要前面加上类作用域区分符就可以了, 调用普通成员函数就需要加上类对象实例指针。