PDA

View Full Version : Drag and drop to list


haskinsj87
09-27-2008, 07:37 PM
What I would like to do is have a full list of names and a blank list. I would like to be able to drag from the full list to the blank list to populate it. I can do all this fine. Here is the problem: The full list is showing a name for a label, but an id number is the data thats important. When I drag to the blank list, it seems that its sending over the label, but not the id.


for(var i:int=0;i<myFullList.dataProvider.length;i++)
{
trace(myFullList.dataProvider[i].label);
trace(myFullList.dataProvider[i].data);
}
for(var i:int=0;i<myNewList.dataProvider.length;i++)
{
trace(myNewList.dataProvider[i].label);
trace(myNewList.dataProvider[i].data);
}


In myFullList, I can get both label and data. In myNewList, I can get the label just fine, but not the data (id number). So when I drag to the new list, is it not sending over all information? Any ideas on how I can get this to work? I wouldnt even mind doing something entirely different that would achieve a similar effect.

haskinsj87
09-27-2008, 09:09 PM
Well I found the solution. I was able to get everything to work properly using a datagrid instead of a list. But that wasn't the best solution, because I only wanted the name to display. So, I changed my xml slightly and everything works fine now.

bad:
<name id="1">Joe</name>
good:
<name>
<id>1</id>
<label>Joe</label>
</name>

so now I can use the list component instead of the datagrid.