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
>
>
>
>