Here's what I do. Loop thru your first array and add the items to an array collection. Before you add the item though, use the contains() method to check to see if the item already exists in your array collection. If it doesn't, add it. Pretty simple and only a few lines of code.
Wayne --- In [email protected], Impudent1 <[EMAIL PROTECTED]> wrote: > > I was beating on this combobox/datagrid thingy and was able to have a > measure of success by using the same arraycollection .. > > BUT, this will populate the dropdown with duplicate entries. I was > trying to figure a way around this with flex array manipulation but I > just couldnt get it. > > Searching around I found this little gem, but I admit extending the > array with a prototype function in flex is a bit over my melon at the mo.. > > Array.prototype.removeDuplicates = function(fn,matchFN) { // removes > duplicate items from an array and returns a new array > var a = ([]).concat(this); > (fn==null) ? a.sort() : a.sort(fn); > if (matchFN!=null) { > for (i in a) if (matchFN(a[i],a[i-1])) a.splice(i,1); > } else { > for (i in a) if (a[i]==a[i-1]) a.splice(i,1); > } > return a; > } > > > Now is this really something I need to deal with, or shouldnt flex be > all snazzy with some neat array manipulation that I just dont seem to see? > > If it is something I need to add, is there any advice about extending > existing flex functions. > > tia > > Impudent1 > LeapFrog Productions > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

