开发者

Flex 4: Descending vertical DataGroup?

I am currently working on a Photoshop-like transformer application to work with DisplayObjects as layers. I have an ArrayCollection which serves as my data provider for my List of values, but the problem is that the items are appearing in ascending order in the List:

0 - Item 1
1 - Item 2
2 - Item 3
3 - Item 4

Since it's a layer manager application, I need the items to appear in descending order like so:

3 - Item 4
2 - Item 3
1 - Item 2
0 - Item 1

This is because layer 0 is at the bottom of the stack, whereas layer 3 is at the top, rather than the other way around which is the way Flex is currently displaying things.

I know that I can simply apply a Sort to my ArrayCollection to cause the items to be sorted in reverse order, but this breaks functionality in my application. I was wondering if it woul开发者_开发知识库d be possible to essentially modify my Spark List or DataGroup to have the layout render items backwards. Does anyone know of a short cut by which to do this?


Here's a clue (I'm still working on it) : I created a VerticalReversedLayout.as class based on VerticalLayout. In updateDisplayListVirtual and/or updateDisplayListReal there is a for (var...) positioning the children on the y axis, just invert the direction of the loop. Then you just assign this layout to your DataContainer (or List in my case). It works perfectly.

If you use the dragMove feature, you may have to modify calculateDropIndex as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜