1

Does anybody know how i can create a stacking list component (just like photoshop) where the first row starts at the bottom and the second on above the bottom and so on. Normally the list component works like this.

0

1

2

3

what i need is a list component that works like this

3

2

1

0

To illustrated my question i have uploaded a picture of the component i need to build. The rowindex of the inverted list component must start at the bottom. meaning that the lowest row in the list is always zero.

alt text

Does anybody know how i can accomplish this?

Thanks

DJ

DJ.
  • 2,031
  • 2
  • 13
  • 22
  • Add the items in reversed order? – poke Nov 09 '10 at 10:02
  • Thanks Poke, but i didn't ask the question correctly. I've edit my question and added a picture to ilustrate my question. Would you be so kind to look at the question again? – DJ. Nov 09 '10 at 12:08
  • do you really need the indexes of the items to be in reverse order or just the data displaying? If the former, what is the use case? I could probably help you extend the list class or you could potentially use a repeater, but im thinking there might be an easier way to achieve what you are after. – Ryan Guill Nov 09 '10 at 14:08
  • I'm building a photoshop style app. With a canvas and a layer stack list component. The layers indexes on the layer stack list component represent the depth of the layers on the canvas. The layer with the lowest index in the stack list component must be on the bottom so that it's obvious for the user that it's the most far back layer on the canvas. The reason why i've choosen the list component to create the layer stack component is because of the drag and drop functions such as calculateDropIndex. – DJ. Nov 09 '10 at 18:51

3 Answers3

1

one way of doing this is to always add the row in the container using this.addChildAt(0); by doing this every new row will be added to zero index and its order will be reverted from default order

  • Thanks Sobi, but i didn't ask the question correctly. I've edit my question and added a picture to illustrate my question. Would you be so kind to look at the question again? – DJ. Nov 09 '10 at 12:09
0

Define a new layout to do this. This answer has some starting links.

Make sure you get the virtual layout working as well for the list control (I suggest just grabbing the VerticalLayout and changing the updateDisplayListReal.

Community
  • 1
  • 1
Gregor Kiddie
  • 3,119
  • 1
  • 19
  • 16
0

obviously you are storing the layers information in array or something like this. just revers the the array before assigning it to list control.

that is

var a:Array = ["1","2","3"];
a.reverse();

now it will look like

// 3 2 1 when assigned to list control as data provider.
Badr
  • 10,384
  • 15
  • 70
  • 104