从as3中的方法获取对象

发布于 2024-09-06 18:47:41 字数 32 浏览 0 评论 0原文

有没有办法知道方法(函数对象)来自哪个对象? TX

Is there a way to know from which object a method (a Function object) came from?
tx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猫烠⑼条掵仅有一顆心 2024-09-13 18:47:41

关键字“this”将为您提供方法(“函数”)所在的对象(除非您使用委托。)

您可以使用arguments.callee来获取对当前函数的引用,但没有arguments.caller可以获取调用你的函数的对象。您必须将该对象作为参数传递。

http://livedocs.adobe.com/flex/2/langref/参数.html#callee

The keyword "this" will give you the object the method ("function") is located (unless you are using delegates.)

You can use arguments.callee to get a reference to the current function, but there's no arguments.caller to get the object calling your function. You'll have to pass that object as an argument.

http://livedocs.adobe.com/flex/2/langref/arguments.html#callee

橪书 2024-09-13 18:47:41

不完全正统,也不高效,但您可以尝试一下这个溢出用户的原始帖子:

StackTrace在 Flash/ActionScript 3.0 中

Not altogether orthodox, nor efficient, but you could play around with this overflow user's original post:

StackTrace in Flash / ActionScript 3.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文