Try this
Class Cs {
public var item1;
public var item2;
public var item3;
}
Create instance
var cs_Instance:Cs = new Cs();
cs_Instance.Item1 = '1';
cs_Instance.Item2 = undefined;
cs_Instance.Item3 = '3';
for ( item in cs_Instance )
{
if ( Instance[item] == undefined )
{
//do something
}
}
-----Original Message-----
From: goran187 [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 26, 2005 9:10 AM
To: [email protected]
Subject: [flexcoders] Class iteration
I have a class with 3 variables
class cs {
public var item1;
public var item2;
public var item3;
}
I am importing this class in my main AS file and assigning values to the
variables
var cs_Instance:cs = new cs();
cs.Item1 = '1';
cs.Item2 = undefined;
cs.Item3 = '3';
I want to iterate through the values of cs_Instance and make identify which
item is undefined.
for (item:Object in cs_Instance) {
if (item == undefined) {//do something}
}
THIS DID NOT WORK.
It returned the Item name from the class not the actual value. So the value
of item within the for loop is set to Item1(Item2..Item3)
I am coming from a .NET environment and this same method is fine there. What
is the solution in Flex?
Thanks,
Goran
Yahoo! Groups Links
----
This email may contain confidential and privileged material for the sole use of
the intended recipient(s). Any review, use, distribution or disclosure by
others is strictly prohibited. If you are not the intended recipient (or
authorized to receive for the recipient), please contact the sender by reply
email and delete all copies of this message.
To reply to our email administrator directly, send an email to
[EMAIL PROTECTED]
Littler Mendelson, P.C.
http://www.littler.com