Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-17-2005, 01:49 AM   #1
xbrotherx
Member
 
Join Date: Feb 2004
Location: Texas
Posts: 85
Default Sortable ListBox-type Component??

Ok, so I really don't want to write my own component (even though it would be good practice for me) so I am asking you all first if you know how to do this with the existing ListBox or with another component out there.

I need to have a list of items that are displayed in a default order but can be reordered by the user in any order they choose. This can be done simply by and up arrow and a down arrow. So when the user selects a row, they click one of the arrows to move it up or down in the hierarchy of the list.

I was hoping that the ListBox component would do this but I could not find any built in methods or properties that allowed this. I am populating this list from an xml file with label/data pairs.

Can anyone point me in the right direction for this. I would be more than happy to provide more info or explanation if needed.

Thanks!!!
xbrotherx is offline   Reply With Quote
Old 06-17-2005, 02:07 AM   #2
sleekdigital
I like pizza!
 
Join Date: Feb 2003
Location: PA
Posts: 1,310
Send a message via AIM to sleekdigital Send a message via MSN to sleekdigital Send a message via Yahoo to sleekdigital
Default

Here is one approach ...
store the lable and any other needed data about the selected item in some temporary variables ... use removeItemAt() to remove the selected item. Use addItemAt() to rebuild the item in the new location using the temporary variables
sleekdigital is offline   Reply With Quote
Old 06-17-2005, 01:11 PM   #3
xbrotherx
Member
 
Join Date: Feb 2004
Location: Texas
Posts: 85
Default

Oh yeah! Nice! Let me take a look at that. That will atleast get me started.

Ultimately, "they" want to be able to drag n' drop the list items to a new position in the list as well, so that will be interesting to figure out. But for now to be able to order the items via up/down arrows will be great. Plus I get the built in functionality and methods that already exist with that monster.

Thx again!
xbrotherx is offline   Reply With Quote
Old 06-17-2005, 01:30 PM   #4
sleekdigital
I like pizza!
 
Join Date: Feb 2003
Location: PA
Posts: 1,310
Send a message via AIM to sleekdigital Send a message via MSN to sleekdigital Send a message via Yahoo to sleekdigital
Default

For drag and drop, you have some choices... You could make your own implemetation of cellRenderer that includes that functionality... that might be doable. Or you might find some third party solution that does that or makes it easier to do it. If you go that route, I have a List Box alternative here ... http://www.layer51.com/proto/d.aspx?f=1396. It might be a little easier using it as a starting point than the MM list box... hard to say. If you do, let me know... I'll try to help and it would be cool to add that functionality to the prototype site.
sleekdigital is offline   Reply With Quote
Old 06-20-2005, 01:39 PM   #5
xbrotherx
Member
 
Join Date: Feb 2004
Location: Texas
Posts: 85
Default

Thanks sleekdigital! I will check your ListBox out as well. I will let you know if I get anything accomplished or if I need some help on this.
xbrotherx is offline   Reply With Quote
Old 06-20-2005, 02:07 PM   #6
sleekdigital
I like pizza!
 
Join Date: Feb 2003
Location: PA
Posts: 1,310
Send a message via AIM to sleekdigital Send a message via MSN to sleekdigital Send a message via Yahoo to sleekdigital
Default

FYI, there is a small bug in the code that is up there now. The ScrollList class needs to be initialized with EventDispatcher in order for the itemSelected event to work.
sleekdigital is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:59 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.