Link to home
Start Free TrialLog in
Avatar of Edanisko
Edanisko

asked on

how do i justify text with math

I need to write an algorithm that will full jusity a number of text links along a line in action script.  i can read any programming language so information in any language is appreciated.

The idea is this:

if therer are 5 links of various sizes that are situated on a menu that can be 600 pixels wide, i need  to center then and adjust the spaces between each item such that the fill the available horizontal area.  Dont worry about what happens if they over fill the available space.
ASKER CERTIFIED SOLUTION
Avatar of jhshukla
jhshukla
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Edanisko
Edanisko

ASKER

Yes.

there here it is in AS3
for(var i:int=0; i<=_NavItems.length-1;i++){
	if (i==0){
		_NavItems[i].x = 0;
	} else {
		_NavItems[i].x =amountOfSpaceBetweenLinks + _NavItems[i-1].x + _NavItems[i-1].width;
	}
	_NavItems[i].visible=true;
	
}

Open in new window