我有一个代表数据库表的对象。我想遍历这个对象并打印打印每个值。我可以用什么来做到这一点?
我想在我的 mxml 中执行此操作而不是 actionscript
对于每个对象属性,我想创建一个输入字段
最佳答案
查找有关 Flex 3 循环的文档。如果你这样做了,你会发现:
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 .
关于flex3 - flex 3 遍历对象值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/674158/