I think this line:
if(!numThings[i].selected){ //
should be:
if(!things[i].selected){ //
Tracy
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Doug McCune
Sent: Tuesday, June 24, 2008 12:11 PM
To: [email protected]
Subject: Re: [flexcoders] Looking for the right loop
There's nothing wrong with your code. You can also use a for each loop
instead, which might be a bit faster, but doesn't give you elements in
any kind of order.
But you could try this for each loop:
for each(var thing:Object in things) {
if(thing.selected == false) {
//whatever
}
}
Just note that using a for loop from 0 to the number of items will give
you those items in order, but a for each loop will give you them in
non-sequential order.
Doug
On Tue, Jun 24, 2008 at 8:57 AM, fumeng5 <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:
Hi,
I'm confused on how to best create a loop to do the following:
discover if each element's "selected" property is set to false.
Basically, I just want to detect when all elements of my array have a
"selected" property set to false.
Here's my code:
var numThings:int = things.length;
for (var i:int=0;i<numThings;i++){
if(!numThings[i].selected){ //
}
}
I know I'm not using the correct loop, I just can't figure out how to
better approach this problem. Any tips are very much appreciated.
Thank you.
Fumeng.