如何在 ActionScript 3 中从类的实例到类对象? [英] How do I get from an instance of a class to a Class object in ActionScript 3?

查看:24
本文介绍了如何在 ActionScript 3 中从类的实例到类对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从该类的实例中获取 actionscript 类 Class 的实例?

How do you get an instance of the actionscript class Class from an instance of that class?

在 Python 中,这将是 x.__class__;在 Java 中,x.getClass();.

In Python, this would be x.__class__; in Java, x.getClass();.

我知道某些可怕的黑客可以做到这一点,但我正在寻找一种内置的语言工具,或者至少是一个建立在可靠事物上的库例程.

I'm aware that certain terrible hacks exist to do this, but I'm looking for a built-in language facility, or at least a library routine built on something reliable.

推荐答案

您可以通过基础 Object 类的 'constructor' 属性获得它.即:

You can get it through the 'constructor' property of the base Object class. i.e.:

var myClass:Class = Object(myObj).constructor;

这篇关于如何在 ActionScript 3 中从类的实例到类对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆