| Package | flash.text.engine | 
| Class | public final class SpaceJustifier | 
| Inheritance | SpaceJustifier  TextJustifier  Object | 
| Language version: | ActionScript 3.0 | 
| Runtime version: | AIR 1.5 | 
 Use the constructor new SpaceJustifier() to create a SpaceJustifier object before setting its properties. 
 Setting the properties of a SpaceJustifier object after you apply it to a TextBlock does not invalidate the TextBlock.
See also
| Property | Defined by | ||
|---|---|---|---|
|  | constructor : Object 
	 A reference to the class object or constructor function for a given object instance. | Object | |
| letterSpacing : Boolean 
     Specifies whether to use letter spacing during justification. | SpaceJustifier | ||
|  | lineJustification : String 
     Specifies the line justification for the text in a text block. | TextJustifier | |
|  | locale : String 
     Specifies the locale to determine the justification rules for the text in a text block. | TextJustifier | |
| maximumSpacing : Number 
     Specifies the maximum spacing (as a multiplier of the width of a normal space) between words to use during justification. | SpaceJustifier | ||
| minimumSpacing : Number 
     Specifies the minimum spacing (as a multiplier of the width of a normal space) between words to use during justification. | SpaceJustifier | ||
| optimumSpacing : Number 
     Specifies the optimum spacing (as a multiplier of the width of a normal space) between words to use during justification. | SpaceJustifier | ||
|  | prototype : Object [static]
	 A reference to the prototype object of a class or function object. | Object | |
| Method | Defined by | ||
|---|---|---|---|
| 
SpaceJustifier(locale:String = "en", lineJustification:String = "unjustified", letterSpacing:Boolean = false) 
     Creates a SpaceJustifier object. | SpaceJustifier | ||
| 
	 Constructs a cloned copy of the SpaceJustifier. | SpaceJustifier | ||
|  | [static]
	 Constructs a default TextJustifier subclass appropriate to the specified locale. | TextJustifier | |
|  | 
	 Indicates whether an object has a specified property defined. | Object | |
|  | 
	 Indicates whether an instance of the Object class is in the prototype chain of the object specified 
	 as the parameter. | Object | |
|  | 
	 Indicates whether the specified property exists and is enumerable. | Object | |
|  | 
     Sets the availability of a dynamic property for loop operations. | Object | |
|  | 
	 Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
|  | 
	 Returns the string representation of the specified object. | Object | |
|  | 
	 Returns the primitive value of the specified object. | Object | |
| letterSpacing | property | 
letterSpacing:Boolean  [read-write]
| Language version: | ActionScript 3.0 | 
| Runtime version: | AIR 1.5 | 
Specifies whether to use letter spacing during justification.
The default value is false
    public function get letterSpacing():Boolean
    public function set letterSpacing(value:Boolean):void
| maximumSpacing | property | 
maximumSpacing:Number  [read-write]
| Language version: | ActionScript 3.0 | 
| Runtime version: | AIR 2 | 
     Specifies the maximum spacing (as a multiplier of the width of a normal space) between words to use during justification.
     If letterSpacing is true, letter spacing will be used after the spaces between words reach the maximum.
     If letterSpacing is false, the spaces between words will be expanded beyond the maximum.
          
The default value is 1.5
    public function get maximumSpacing():Number
    public function set maximumSpacing(value:Number):void
| ArgumentError — Thevaluespecified is less thanoptimumSpacing. | 
| minimumSpacing | property | 
minimumSpacing:Number  [read-write]
| Language version: | ActionScript 3.0 | 
| Runtime version: | AIR 2 | 
Specifies the minimum spacing (as a multiplier of the width of a normal space) between words to use during justification.
The default value is 0.5
    public function get minimumSpacing():Number
    public function set minimumSpacing(value:Number):void
| ArgumentError — Thevaluespecified is less than zero or greater thanoptimumSpacing. | 
| optimumSpacing | property | 
optimumSpacing:Number  [read-write]
| Language version: | ActionScript 3.0 | 
| Runtime version: | AIR 2 | 
Specifies the optimum spacing (as a multiplier of the width of a normal space) between words to use during justification.
The default value is 1.0
    public function get optimumSpacing():Number
    public function set optimumSpacing(value:Number):void
| ArgumentError — Thevaluespecified is less thanminimumSpacingor greater thanmaximumSpacing. | 
| SpaceJustifier | () | constructor | 
public function SpaceJustifier(locale:String = "en", lineJustification:String = "unjustified", letterSpacing:Boolean = false)
| Language version: | ActionScript 3.0 | 
| Runtime version: | AIR 1.5 | 
Creates a SpaceJustifier object. The LineJustification class contains constants for specifying the types of line justification that you can apply.
Parameters| locale:String(default = "en")— The locale to determine the justification rules.
	 The default value is"en". | |
| lineJustification:String(default = "unjustified")— The type of line justification for the paragraph. 
	 UseLineJustificationconstants for this property.
     The default value isLineJustification.UNJUSTIFIED. | |
| letterSpacing:Boolean(default =false)— Specifies whether to use letter spacing during justification.
     The default value isfalse. | 
| ArgumentError — Thelocalespecified isnullor too short to represent a valid locale. | |
| ArgumentError — ThelineJustificationspecified is not a member ofLineJustification. | 
See also
| clone | () | method | 
public override function clone():TextJustifier
| Language version: | ActionScript 3.0 | 
| Runtime version: | AIR 1.5 | 
Constructs a cloned copy of the SpaceJustifier.
Returns| TextJustifier— 
                        A copy of theSpaceJustifierobject. | 
package {
    import flash.display.Sprite;
	import flash.text.engine.TextBlock;
	import flash.text.engine.TextElement;
	import flash.text.engine.TextLine;
	import flash.text.engine.ElementFormat;
	import flash.text.engine.SpaceJustifier;
	import flash.text.engine.LineJustification;
	
	public class SpaceJustifierExample extends Sprite {
		
		public function SpaceJustifierExample():void {
			var str:String = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
			"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut " +
			"enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " +
			"aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit " +
			"in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur " +
			"sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt " +
			"mollit anim id est laborum.";
			
			var format:ElementFormat = new ElementFormat(null, 12, 0xCC0000);
			var textElement:TextElement = new TextElement(str, format);
			var spaceJustifier:SpaceJustifier = new SpaceJustifier("en", LineJustification.ALL_BUT_LAST);
			spaceJustifier.letterSpacing = true;
			var textBlock:TextBlock = new TextBlock();
			textBlock.content = textElement;
			textBlock.textJustifier = spaceJustifier;
			createLines(textBlock);
		}
		
		private function createLines(textBlock:TextBlock):void {
        
            var yPos = 20;
            var textLine:TextLine = textBlock.createTextLine (null, 150);
 
            while (textLine)
            {
                addChild(textLine);
                textLine.x = 15;
                yPos += textLine.textHeight+2;
                textLine.y = yPos;
                textLine = textBlock.createTextLine(textLine, 150);
            }        
        }
	}
}
