I have built a custom comboBox component that takes an XML object as the dataprovider (see attached). When it is in enhanced mode, the auto complete and auto filter methods are available to sort the contents of the comboBox. It does this by way of a RegExp created by the value of the user input that tests against attributes in the child nodes of the dataprovider through a loop operation.
I want to optimize this searching method to improve speeds for very large lists. Right now I have 2 options for accessing the child nodes of an XML object.
Code:
var xml : XML =<list>
<row value="AL" label="Alabama" />
<row value="AK" label="Alaska"/>
<row value="AZ" label="Arizona" />
<row value="AR" label="Arkansas"/>
<row value="CA" label="California"/>
<row value="CO" label="Colorado"/>
</list>
// Shortened for brevity
trace(xml.*, xml.children());
They both return an XMLList with all of the child nodes but by reading the documentation, * seems to be the preferred method for accessing nodes and attributes. I am just wondering what the difference is and whether I might see a performance gain by using one over the other.
Just because you changed the code, doesn't mean it's yours
It is always better to have a concrete path to something so that the player does not need to search or needs to memorize large chunks of whatever. To my experience it is not the parsing of the XML, which is important in the end for speed but the variables and display options. Adding the datatype for every variable, reducing the number of displayobjects to a minimum, choosing Sprites over Movieclips, creating static variables for certain objects all increases performance quite a lot.
- The right of the People to create Flash movies shall not be infringed. -