flex 3 遍历对象值 [英] flex 3 iterate through object values
问题描述
我有一个代表数据库表的对象.我想遍历这个对象并打印每个值.我可以用什么来做到这一点?
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 而不是 actionscript 中执行此操作
i want to do this inside my mxml not actionscript
为每个对象属性我想创建一个输入字段
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 循环来遍历通用对象的属性(对象属性不按任何特定顺序保存,因此属性可能以看似随机的顺序出现):
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屋!