Hopefully flex has been around long enough that some of you flash guru's know how to use it.
I'm trying to get the index of an object inside an array collection, but the API information states that contains and getitemindex only return a result based on == of the provided object.
Given that the object does not appear to have an overridable equals method, and I can't find an IComparable interface, does anyone know if I can control what values the searching is performed on?
Given a 'Tag' object, which has a id, parent, desc, etc, and placed into an ArrayCollection, I want to get the tag associated with the tag id:
The problem here is, unless the item has explicitly been defined, I can't get the contains result.
// This is in a graph object, also containing a get item index and get item at
public function contains(item:Tag):Boolean
So, running something like:
I want to convert my tag collection into a vertex collection, so I can easily add and remove neighbours from my adjacency graph. Since I won't know what the neighbour relationships will be, this contains method will not work.
// Graph has already had this tag added
var tag:Tag = new Tag();
trace(graph.contains(tag)); // This returns false
trace(graph.contains(tag)); // This returns true, now that all the fields have been added and are the same (assumably)
Any ideas how to control the search behaviour of the contains/getitemindex values on the array collection? I was thinking of a compareTo, but like I said - no IComparable interface