April 20, 2011

Dynamically Position Elements

by blackbird

Have you ever had to position elements in flash or in a javascript application to look something like iOS’s home-screen?
This script will help you achieve that with minimal customization, it even has scrollable paging.

[code lang="js" inline="yes"]var vspacing = hspacing; //vertical spacing in between each icon (set to same as hspacing)

var columns=4; //number of icons in a row

var rows =4; //number of rows per "page"

//within some kind of loop assuming count is the iterator (base 0)