Problem with a property name of an object
I have this function:
private function returnFees(row:Object,name:String):int
{
var fee:int;
for each(var obj:Object in row)
{
if(obj==name)
{
//fee=obj as int;
}
开发者_如何学JAVA }
return fee;
}
I want to compare the name of properties to the 'name'. But in this code the 'obj' is giving me the values of properties not the name.
Any ideas? thank you
It's not a for each
you have to use but a simple for
. for each
will give you the values and for
the property name :
private function returnFees(row:Object,name:String):int {
var fee:int;
for (var rowName:String in row) {
if(rowName == name) {
//fee=obj as int;
}
}
return fee;
}
精彩评论