从as3中的方法获取对象
有没有办法知道方法(函数对象)来自哪个对象? TX
Is there a way to know from which object a method (a Function object) came from?
tx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有没有办法知道方法(函数对象)来自哪个对象? TX
Is there a way to know from which object a method (a Function object) came from?
tx
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
关键字“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
不完全正统,也不高效,但您可以尝试一下这个溢出用户的原始帖子:
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