# 2 questions about list compnents

**URL:** <https://forum.kirupa.com/t/2-questions-about-list-compnents/254953>\
**Category:** flash\
**Created:** [March 17, 2008, 5:44pm UTC](https://forum.kirupa.com/t/2-questions-about-list-compnents/254953 "2008-03-17T17:44:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulcybulski](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@paulcybulski](https://forum.kirupa.com/u/paulcybulski)\
**Post date:** [March 17, 2008, 5:44pm UTC](https://forum.kirupa.com/t/2-questions-about-list-compnents/254953/1 "2008-03-17T17:44:08Z")

</div>

Ok first question…how do I sort the list component by numerical values? At the moment, the sort sorts as follows 1 10 100 2 20 200 3 30 300…i want it to be 1 2 3 10 20 30 100 200 300…I am using the following code to accomplish this…

listAccChild2.exList.sortItemsBy(“label”, “ASC”);

(I have 3 list components inside of an Accordion component)

my second question…Is there a way I can reuse my listeners because basically the actions of the lists are the same…when you mouse over the elements I want the booths to highlight…when you click it zooms to a booth and highlights it something else…I am accomplishing this by duplicating the listeners…this seems redundant…

```
 ActionScript Code:
 [FONT=Courier New][LEFT][COLOR=#000000] **var** [/COLOR] listHandler:[COLOR=#0000ff]Object[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]Object[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

```

listHandler.[COLOR=#000080]itemRollOver[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]showLoad && !boxOpen[COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] shp:XMLShape = [COLOR=#000000] **new** [/COLOR] XMLShape;  
shp.[COLOR=#000080]highLight[/COLOR]COLOR=#000000[/COLOR];  
isLight = [COLOR=#000000] **true** [/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **var** [/COLOR] listHandler2:[COLOR=#0000ff]Object[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]Object[/COLOR]COLOR=#000000[/COLOR];  
listHandler2.[COLOR=#000080]itemRollOut[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]showLoad && !boxOpen[COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] shp:XMLShape = [COLOR=#000000] **new** [/COLOR] XMLShape;  
shp.[COLOR=#000080]hLback[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **var** [/COLOR] listHandler3:[COLOR=#0000ff]Object[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]Object[/COLOR]COLOR=#000000[/COLOR];  
listHandler3.[COLOR=#000080]change[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]showLoad && !boxOpen[COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] shp:XMLShape = [COLOR=#000000] **new** [/COLOR] XMLShape;  
removePrevTargetCOLOR=#000000[/COLOR];  
shp.[COLOR=#000080]listClick[/COLOR]COLOR=#000000[/COLOR];  
listArr[COLOR=#000000][[/COLOR]lCc[COLOR=#000000]][/COLOR] = listAccChild1.[COLOR=#000080]exList[/COLOR].[COLOR=#000080]getItemAt[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]data[/COLOR];  
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]listArr[COLOR=#000000][[/COLOR]lCc[COLOR=#000000]][/COLOR] != listArr[COLOR=#000000][[/COLOR]lCc - [COLOR=#000080]1[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
shp.[COLOR=#000080]listChange[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
lCc++;  
boothLight = [COLOR=#000000] **true** [/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **var** [/COLOR] listHandlerX:[COLOR=#0000ff]Object[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]Object[/COLOR]COLOR=#000000[/COLOR];  
listHandlerX.[COLOR=#000080]itemRollOver[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]showLoad && !boxOpen[COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] shp:XMLShape = [COLOR=#000000] **new** [/COLOR] XMLShape;  
shp.[COLOR=#000080]highLight[/COLOR]COLOR=#000000[/COLOR];  
isLight = [COLOR=#000000] **true** [/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#808080]_//trace(listAccChild2.exList.getItemAt(evt\_obj.index).data);_[/COLOR]  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **var** [/COLOR] listHandlerX2:[COLOR=#0000ff]Object[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]Object[/COLOR]COLOR=#000000[/COLOR];  
listHandlerX2.[COLOR=#000080]itemRollOut[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]showLoad && !boxOpen[COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] shp:XMLShape = [COLOR=#000000] **new** [/COLOR] XMLShape;  
shp.[COLOR=#000080]hLback[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **var** [/COLOR] listHandlerX3:[COLOR=#0000ff]Object[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]Object[/COLOR]COLOR=#000000[/COLOR];  
listHandlerX3.[COLOR=#000080]change[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]showLoad && !boxOpen[COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] shp:XMLShape = [COLOR=#000000] **new** [/COLOR] XMLShape;  
removePrevTargetCOLOR=#000000[/COLOR];  
shp.[COLOR=#000080]listClick[/COLOR]COLOR=#000000[/COLOR];  
listArr[COLOR=#000000][[/COLOR]lCc[COLOR=#000000]][/COLOR] = listAccChild2.[COLOR=#000080]exList[/COLOR].[COLOR=#000080]getItemAt[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]data[/COLOR];  
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]listArr[COLOR=#000000][[/COLOR]lCc[COLOR=#000000]][/COLOR] != listArr[COLOR=#000000][[/COLOR]lCc - [COLOR=#000080]1[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
shp.[COLOR=#000080]listChange[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
lCc++;  
boothLight = [COLOR=#000000] **true** [/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]

listAccChild1.[COLOR=#000080]exList[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“change”[/COLOR], listHandler3[COLOR=#000000])[/COLOR];  
listAccChild1.[COLOR=#000080]exList[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“itemRollOut”[/COLOR], listHandler2[COLOR=#000000])[/COLOR];  
listAccChild1.[COLOR=#000080]exList[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“itemRollOver”[/COLOR], listHandler[COLOR=#000000])[/COLOR];  
listAccChild2.[COLOR=#000080]exList[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“change”[/COLOR], listHandlerX3[COLOR=#000000])[/COLOR];  
listAccChild2.[COLOR=#000080]exList[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“itemRollOut”[/COLOR], listHandlerX2[COLOR=#000000])[/COLOR];  
listAccChild2.[COLOR=#000080]exList[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“itemRollOver”[/COLOR], listHandlerX[COLOR=#000000])[/COLOR];  
[/LEFT]  
[/FONT]

this is where you can see it in action

[http://www.expocadvr.com/new/default.html](http://www.expocadvr.com/new/default.html)

please let me know what you guys think…
