我怎样才能在ActionScript中的对象属性的列表? [英] How can I get list of properties in an object in Actionscript?

查看:182
本文介绍了我怎样才能在ActionScript中的对象属性的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据提供器和我的阵列的filterFunction已分配给我的数据提供器。

I have a dataprovider and a filterfunction for my array that's assigned to my dataprovider.

我怎样才能得到属于数据提供器(item.data)的每一行中,因为它被传递到的filterFunction属性的列表?

How can I get a list of the properties that are in each row of the dataprovider (item.data) as it gets passed to the filterfunction?

例如,如果我的对象包含:

For instance, if my object contained:

  • 对象
    • 名称
    • 电子邮件
    • 地址
    • Object
      • name
      • email
      • address

      然后我想,在我的filterFunction才能够看的姓名,电子邮件和地址。不幸的是,我不知道这些属性将是前手。

      Then I would want, in my filterfunction to be able to look at name, email and address. Unfortunately, I don't know what these properties will be before hand.

      任何想法?

      推荐答案

      如果它是一个动态的对象,我相信你可以做这样的事情:

      If it's a dynamic object I believe you can just do something like this:

      var obj:Object; // I'm assuming this is your object
      
      for(var id:String in obj) {
        var value:Object = obj[id];
      
        trace(id + " = " + value);
      }
      

      这就是它是如何在AS2做的,我相信仍然可以工作在AS3动态对象。我认为,这将显示性能是在非动态对象更加有限。

      That's how it's done in AS2, and I believe that still works for dynamic objects in AS3. I think the properties that it will show is more limited on non-dynamic objects.

      这篇关于我怎样才能在ActionScript中的对象属性的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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