静态停止/播放功能
假设我想使用frameScript 方法向某些帧添加一些停止和播放方法。
通常我会声明 stop 函数:
private function $FUN_FrameStop():void {
stop();
return;
}
然后像这样使用它:
addFrameScript(47, $FUN_FrameStop, 122, $FUN_FrameStop);
我的问题是,如何创建与静态函数相同的 $FUN_FrameStop?
静态函数不允许使用 this
因为静态成员绑定到类并且不会被该类的实例继承。
那么,有没有办法创建一个类似于 $FUN_FrameStop 的静态函数?
Let's say I would want to use the frameScript method to add some stop and play methods to some frames.
Normally I would declare the stop function:
private function $FUN_FrameStop():void {
stop();
return;
}
and then use it like this:
addFrameScript(47, $FUN_FrameStop, 122, $FUN_FrameStop);
My question is, how can I create the same $FUN_FrameStop as a static function?
Static functions do not allow the use of this
since static members are bound to a class and are not inherited by that class' instances.
So, is there a way to create a function similar to $FUN_FrameStop, but static?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在类外部但在包中声明一个函数
,然后您可以在包含包后使用 Func() 调用它(如果需要)
You may declare a function outside of class but in package
then you may call it everywhare with Func() after including the package ( if needed )
我从未动态添加任何框架脚本但是..您是否尝试使用实例作为参数?
I never added any frame script dynamically but.. did you try using the instance as the parameter?
答案是,除非我有对类实例的静态引用,否则没有办法,但这不是我想要的。
The answer is that there's no way unless I have a static reference to the class instance, but that's not what I want.