Flex list sorting animation?
I have a list which displays votes cast on things in a descending order (=the dataprovider has a sort assigned). The elements have variable height, but there are not so many elements, so i do not need to use a virtual layout
My problem is that this list needs to be updated real-time and i want to make this hap开发者_开发问答pen with a nice animation. (e.g. if an item overtakes another by votes, then they swap places.) Anyone knows how to make this animation with Flex 4.5 (spark list)?
Do i need to write a custom layout? ThanksIf I were you, I'd just create a custom component which would have a simple layout (VGroup, maybe within a Scroller if you need a scrollbar) which then dynamically add item renderers to it. The thing about this one though is that your item renderer never changes it's data property. Make sure that the item renderer uses binding for it's data, and then on whatever you're sorting, have an animation between indexes of 2 items, make sure you set 'includeInLayout=false' before the animation for both items and just tween between their positions.
There are other ways of doing it using List, but then you'd have to make duplicates of the item renderers for the animations while the real ones are hidden and change their values. Not sure which one would be best in this case...
精彩评论