简体   繁体   English

Flex 4:下降垂直数据组?

[英]Flex 4: Descending vertical DataGroup?

I am currently working on a Photoshop-like transformer application to work with DisplayObjects as layers. 我目前正在开发类似Photoshop的转换器应用程序,以将DisplayObjects作为图层使用。 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: 我有一个ArrayCollection用作我的值列表的数据提供程序,但是问题是项目在列表中以升序出现:

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. 这是因为第0层位于堆栈的底部,而第3层位于堆栈的顶部,而不是Flex当前显示事物的另一种方式。

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. 我知道我可以简单地对ArrayCollection进行排序,以使项目以相反的顺序排序,但这会破坏应用程序的功能。 I was wondering if it would be possible to essentially modify my Spark List or DataGroup to have the layout render items backwards. 我想知道是否有可能从本质上修改我的Spark List或DataGroup以使布局向后渲染项目。 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. 这是一个线索(我仍在研究中):我基于VerticalLayout创建了VerticalReversedLayout.as类。 In updateDisplayListVirtual and/or updateDisplayListReal there is a for (var...) positioning the children on the y axis, just invert the direction of the loop. 在updateDisplayListVirtual和/或updateDisplayListReal中,有一个for(var ...)将子代放置在y轴上,只需反转循环的方向即可。 Then you just assign this layout to your DataContainer (or List in my case). 然后,您只需将此布局分配给您的DataContainer(在我的情况下为List)即可。 It works perfectly. 它运作完美。

If you use the dragMove feature, you may have to modify calculateDropIndex as well. 如果使用dragMove功能,则可能还必须修改calculateDropIndex。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM