I have an array, crewPositionsAC that contains a list of position abreviatations - EP, PR, DR, WR, and so on. These positions are read in through an XML file each time my flex application loads. Also being populated from an XML is a project. Within a project, there are positions (a student assigned to a type of position listed within crewPositionsAC). These positions are not necessarily in the correct hierarchy order dictated by crewPositionsAC. I have all the positions within an ArrayCollection (positionsAC) with the following structure:
positionsAC (arrayCollection)
[0] = Array
[0] = startOffset
[1] = numDays
[2] = role
[3] = studentID
[4] = conflict
[5] = studentType
[6] = showInPrinciple
[7] = revisionNumber
*continue until all positions are listed*
My question is this, how can I reorder positionsAC to ensure that the "role" pieces of each array are in the correct order (as dictated by crewPositionsAC)? I've tried a couple different for loops, but nothing even came close.
Edit
So, there are several projects, within each project there are several positions (usually 16 or 17, but there is no set number.
Within a project, there is a variable called positionsAC that has the following structure:
positionsAC:
[0] (array)
[0] = startOffset
[1] = numDays
[2] = role
[3] = studentID
[4] = conflict
[5] = studentType
[6] = showInPrinciple
[7] = revisionNumber
*continue until all positions are listed*
Then, the user can click a button to add another position. When the "Add Crew Member" button is pressed, the user is presented with a list of possible positions to add. Currently, I simply add another array to positionsAC. This results in the recently added crew member to placed on the bottom of the list. I need to take positionsAC and reorder it based on it's [2] item (role) based on the hierarchy defined in the crewPositionsAC. crewPositionsAC has the following structure:
crewPositionsAC:
[0] = EP
[1] = PR
[2] = DR
[3] = WR
* continue until all possible position types are listed
Hope that helps a little bit.