Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function setupWidgets():void
- {
- //loop through the widgets and display them in the scrollPane
- for (var i:int = 0; i < arrayOfWidgets.length; i++)
- {
- scrollPane.addChild(arrayOfWidgets[i]);
- }
- var startXPosition:int = 5;
- var startXPosition:int = 0;
- var startYPosition:int = 0;
- //loop through the widgets and position them in the scrollPane
- for (var j:int = 0; j < arrayOfWidgets.length; j++)
- {
- //start positioning the x value first
- if (j == 0)
- {
- //position the x value
- arrayOfWidgets[j].x = startXPosition;
- //position the y value
- arrayOfWidgets[j].y = startYPosition;
- } else
- {
- //position the x value
- arrayOfWidgets[j].x = arrayOfWidgets[j - 1].x + arrayOfWidgets[j].width + 10;
- //if the number is divisible by 4 increase the layer variable
- if (j % 4 == 1)
- {
- startYPosition++;
- }
- //position the y value
- arrayOfWidgets[j].y = startYPosition;
- }
- }
- }
Add Comment
Please, Sign In to add comment