Just re-parsed that message - Don't get me wrong, I love overkill! I'd have
gone with a helper class that watches an IList rather than subclassing
Collection though. That's how I decided to build my list indexer (get by
fieldValue). That way you can watch any IList, and in my case have multiple
indexes on one list. Also, you could add support for XMLList just by
changing the existing indexer class.

-Josh

On Wed, Jun 25, 2008 at 4:37 PM, Josh McDonald <[EMAIL PROTECTED]> wrote:

> Nice overkill. I'll put in my 2c:
>
> var anySelected : Boolean = false;
> var i : Number;
>
> for (i = 0; i < things.length && !anySelected) {
>     anySelected = things[i].selected;
> }
>
> -Josh
>
>
> On Wed, Jun 25, 2008 at 4:24 PM, Rick Winscot <[EMAIL PROTECTED]>
> wrote:
>
>>  Did I hear someone say 'fancy?' The best loop… isn't one! Especially if
>> you have other mechanisms, like events, that can help reduce the cost of
>> keeping track of a particular item. I've coded two classes; Thing and
>> ThingCollection as an example.
>>
>>
>>
>> http://www.quilix.com/node/16
>>
>>
>>
>> Overkill? Don't much care… can't sleep anyway.
>>
>>
>>
>> Rick Winscot
>>
>>
>>
>>
>>
>> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
>> Behalf Of *Toby Ashley
>> *Sent:* Tuesday, June 24, 2008 12:02 PM
>> *To:* [email protected]
>> *Subject:* Re: [flexcoders] Looking for the right loop
>>
>>
>>
>> There are fancier ways of doing it I'm sure, but changing your code to the
>> following will make it work.
>>
>>
>> var numThings:int = things.length;
>>
>> var nothingSelected:Boolean = true;
>>
>> for (var i:int=0;i<numThings;i++){
>>
>>   // note that it should be things[i] below, not numThings[i] , as
>> numThings is just an integer.
>>   if( things[i].selected ){
>>
>>      nothingSelected = false;
>>
>>   }
>>
>> }
>>
>> // traces true if 0 items are "selected", false if one or more is
>> "selected"
>> trace (nothingSelected);
>>
>>
>>  On Tue, Jun 24, 2008 at 4:57 PM, fumeng5 <[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.
>>
>>
>> ------------------------------------
>>
>> --
>> Flexcoders Mailing List
>> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>> Search Archives:
>> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
>> Links
>>
>>
>>
>>
>>
>>  
>>
>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]




-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to