I cannot figure out how to do this for the life of me.
Is there some sort of formula to figure out the exact spacing?
Printable View
I cannot figure out how to do this for the life of me.
Is there some sort of formula to figure out the exact spacing?
Yes.
Let's assume you have a set of n items which widths sum to W you want to put in a D wide area.
Then the spacing between items shoud be (D - W) / (n + 1)
a=0
b=4
between 'a' and 'b' there are three numbers, and all the numbers are spaced 1 apart.
So a simple formula would be
spacing=x+1
x is whatever we place there.
if x is 2, the next number is 3, because the spacing is 1.
If you wrote an ActionScript function it may look like this:
function space(obj:Object):void
{
var num:Number = 0;
while (num < 4) {
obj.x+=1
}
This says that as long as 'num' is less than 4, the object(whichever you choose) will have 1 added to it's x value (or whatever value you choose).
However, this may or may not be what you will have in the end, in-fact I just want you to see how you might achieve whatever it is you want:
For more info on Loops, try my tutorial here:
http://board.flashkit.com/board/show...56#post4241856
Here is the link for one good spacing calculator for android phones: https://play.google.com/store/apps/d....sm.gapcounter