# \[FMX\] adding an item to at listbox using .additem

**URL:** <https://forum.kirupa.com/t/fmx-adding-an-item-to-at-listbox-using-additem/8487>\
**Category:** flash\
**Created:** [November 22, 2002, 3:12am UTC](https://forum.kirupa.com/t/fmx-adding-an-item-to-at-listbox-using-additem/8487 "2002-11-22T03:12:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdlnhrd](https://avatars.discourse-cdn.com/v4/letter/p/b5a626/32.png) [@pdlnhrd](https://forum.kirupa.com/u/pdlnhrd)\
**Post date:** [November 22, 2002, 3:12am UTC](https://forum.kirupa.com/t/fmx-adding-an-item-to-at-listbox-using-additem/8487/1 "2002-11-22T03:12:14Z")

</div>

I am working on a “cross select” with two list boxes. each list box will be populated from a db (using flash remoting) then the user will be able to move one or all the items from one box to the other.

I am trying to get the move one item from one side to the other first but it doesn’t seem to be working the way I anticipated. when i move the item from one side to the other, it will only add the static content from the label (the hypen in this case) on the other side and not the dynamic data. Since it is adding the hypen I don’t understand while it isn’t adding the rest of the label.

here is the code I have.

#include “NetServices.as”  
#include “DataGlue.as”

if (inited == undefined){  
inited = true;  
var gwURL = “[http://localhost:8500/flashservices/gateway](http://localhost:8500/flashservices/gateway)”;  
NetServices.setDefaultgatewayURL(gwURL);  
gw = NetServices.createGatewayConnection();

btn\_shiftRightOne.setClickHandler(“shiftRightOne”);  
btn\_shiftRightAll.setClickHandler(“shiftRightAll”);  
btn\_shiftLeftOne.setClickHandler(“shiftLeftOne”);  
btn\_shiftLeftAll.setClickHandler(“shiftLeftAll”);

listService = gw.getService(“testsite.combobox”,this);  
listService.getAssignedFunctions();  
listService.getFunctions();  
}  
//populate lb with info from the db  
function getFunctions\_Result(result){  
DataGlue.bindFormatStrings(lb\_Functions,result,"#Category# - #functionname#","#functionname#");  
}  
//populate lb with info from the db  
function getAssignedFunctions\_Result(result){  
DataGlue.bindFormatStrings(lb\_assignedFunctions,result,"#Category# - #functionname#","#functionname#");  
}  
//move selected item to the right  
function shiftRightOne(){  
lb\_assignedFunctions.addItem(lb\_Functions.getSelectedItem().label,lb\_Functions.getSelectedItem().data);  
lb\_Functions.removeItemAt(lb\_Functions.getSelectedIndex());

}

pdlnhrd
