You are probably better off checking if the new user has entered an already used account name on the back end and sending through a Yes/No answer to Flex.
Anyway, You should be able to figure out how to do a sort by perusing this example: http://blog.flexexamples.com/2007/08/05/sorting-an-arraycollection-using-the-sortfield-and-sort-classes/ --- In [email protected], "criptopus" <sd_br...@...> wrote: > > Don't understand why im getting these errors, can anybody help? > > I have just created an arrayCollection from a HTTPService that reads a table > from my database. I am trying to check to see if the new user has entered an > already used account name. > > After reading a number of articles I discovered searching the arrayCollection > was possible but only after sorting the collection, this is what I am having > trouble with. > > Here is my code: > > private function userHandler(event:ResultEvent):void > { > acUsers = event.result.response.data.row; > acUsers.fields = [new SortField("usraccount", true)]; > acUsers.sort=acUsers; > acUsers.refresh(); > } > > I am getting the following error at (acUsers.sort=acUsers;): > > implicit coercion of a value of type > mx.collections:ArrayCollection > to an unrelated type > mx.collections:Sort. > > and also an error at (acUsers.fields = [new SortField("usraccount", true)];) > > Access of possibly undefined property > fields through a refrence with static type mx.collections:ArrayCollection. >

