PDA

View Full Version : List component, drag item


mwmitchell
04-11-2006, 05:34 AM
Hi,

I've been trying for quite a while now to get an event handler attached to a list component, list item. I can't seem to get it working at all. So, hoping someone here could help? :)

My goal:

click on item in list
drag item (ghost of item appears) to any location
release: ghost goes back to list item and is then removed

I can pretty much handle all of that and the code needed to handle the drop, but I need to handle the initial event first. Here is what I have now. content_mc seems to be a container for all of the list items?

for(i in list1.content_mc){
var item:Object = list1.content_mc[i];
item.addEventListener('click', function(){ trace('click'); });
}

Thanks!

jpsoul
06-13-2006, 06:19 PM
you can use the cellRenderer property to customize list items and add onPress to the custom item (check flash's help for how).

or you could also the datagrid component and make it look like a list component (use only 1 column, ect.). The datagrid component fires a cellPress event (onPress for each cell).

i used the last method and it worked well. i used the dg component for a ui to sort items (and then update a db).

-jp