Arvind_India
Arvind_India

Reputation: 3

Numbering the Panels in a canvas according to its position from left to right

i am having a canvas which contains panels that are created dynamicaly.That panels are draggable.So that an user can drag any panel and keep it anywhere in the canvas. My requirement is when we click a button ,we have to change the panel numbers according to its position,that is from left to right. How to find out where the panel is present in canvas and number them in ascending order according to its position.

Upvotes: 0

Views: 39

Answers (1)

Marcela
Marcela

Reputation: 3728

One way to do it would be to add the panels to an Array as they are created. Then, when the button is clicked, you can do a sort on the array by x property:

panelArray.sortOn("x", Array.Numeric);

Once the array has been sorted, you can loop over it and adjust the panel numbers based on their position in the array.

Upvotes: 1

Related Questions