, development services available
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Sam Lai
Sent: Sunday, April 26, 2009 8:21 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] getItemIndex ..returning -1
I'm on my phone
What am I doing wrong. Thanks.
private function getcoursesResult(event:ResultEvent):void{
courses = new ArrayCollection (event.result.COURSELIST as Array);
var newindex:int = courses.getItemIndex('specific course name');
courses_datagrid.selectedIndex=newindex;
Flex is looking for a string in the array with the value 'specific
course name'. In your arraycollection though, you have objects (not
strings), which within them hold multiple strings (TITLE, DESC, REQ).
The only way to match again the title field of every object in the
array is to use a for
3:59 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] getItemIndex ..returning -1
Flex is looking for a string in the array with the value 'specific
course name'. In your arraycollection though, you have objects (not
strings), which within them hold multiple strings (TITLE
= i;
break;
}
}
Sam Lai samuel@gmail.com
Sent by: flexcoders@yahoogroups.com
04/26/2009 12:59 AM
Please respond to
flexcoders@yahoogroups.com
To
flexcoders@yahoogroups.com
cc
Subject
Re: [flexcoders] getItemIndex ..returning -1
Flex is looking for a string in the array
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] getItemIndex ..returning -1
Thank you, but for some reason the index variable is providing me with a -1
value, so the if statement is never true.
var index:int = -1;
for (var i:int = 0; index courses.length; index
: Re: [flexcoders] getItemIndex ..returning -1
Thank you, but for some reason the index variable is providing me with a -1
value, so the if statement is never true.
var index:int = -1;
for (var i:int = 0; index courses.length; index++)
{ -1
26, 2009 8:21 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] getItemIndex ..returning -1
I'm on my phone so I can't see the entirety of the reply, but I used a
variable named i as well as one named index so you know if a match has
been found or not. If index = -1, it means
8 matches
Mail list logo