flex 3迭代对象值 [英] flex 3 iterate through object values

查看:160
本文介绍了flex 3迭代对象值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表示数据库表的对象。我想迭代这个对象并打印每个值。我可以用它做什么?

i have an object which represents a database table. I want to iterate through this object and print printing each value. What can i use to do this?

我想在我的mxml中执行此操作而不是动作脚本

i want to do this inside my mxml not actionscript

object属性我想创建一个输入字段

for each object attribute i want to create an imput field

推荐答案

查看有关Flex 3循环的文档。如果你这样做,你会发现:

Look up the documentation on Flex 3 looping. If you do, you'll find this:


for..in

for..in

for..in 循环遍历对象的属性,或者数组的元素。例如,您可以使用for..in循环来遍历泛型对象的属性(对象属性不以任何特定顺序保存,因此属性可能以看似随机的顺序出现):

The for..in loop iterates through the properties of an object, or the elements of an array. For example, you can use a for..in loop to iterate through the properties of a generic object (object properties are not kept in any particular order, so properties may appear in a seemingly random order):



var myObj:Object = {x:20, y:30};
for (var i:String in myObj)
{
    trace(i + ": " + myObj[i]);
}
// output:
// x: 20
// y: 30

我建议你看一下 DataGrid 和自定义 ItemEditors

Instead of trying to create an input field for each object, I'd suggest you take a look at DataGrid and custom ItemEditors.

这篇关于flex 3迭代对象值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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