Guest User

Nitin Mukesh

a guest
May 29th, 2009
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.50 KB | None | 0 0
  1. package {
  2.     import flash.display.Sprite;
  3.     import flashx.textLayout.container.DisplayObjectContainerController;
  4.     import flashx.textLayout.container.IContainerController;
  5.     import flashx.textLayout.elements.ParagraphElement;
  6.     import flashx.textLayout.elements.SpanElement;
  7.     import flashx.textLayout.elements.TextFlow;
  8.     import flashx.textLayout.formats.CharacterFormat;
  9.     import flash.text.engine.FontLookup;
  10.     import flash.text.engine.Kerning;
  11.  
  12.     public class characterFormat_ex extends Sprite
  13.     {
  14.         public function characterFormat_ex()
  15.         {
  16.             var textFlow:TextFlow = new TextFlow();
  17.             var charFormat:CharacterFormat = new CharacterFormat();
  18.             charFormat.color = 0x000000;
  19.             charFormat.fontFamily = "Arial";
  20.             charFormat.fontSize = 12;
  21.             charFormat.kerning = flash.text.engine.Kerning.ON;
  22.             charFormat.baselineShift = flashx.textLayout.formats.BaselineShift.SUPERSCRIPT;
  23.             textFlow.hostCharacterFormat = charFormat;
  24.  
  25.             var p:ParagraphElement = new ParagraphElement();
  26.             var span:SpanElement = new SpanElement();
  27.             span.text = "Sample text showing the use of CharacterFormat with a TextFlow\nLine 2\nLine 3";
  28.             p.addChild(span);
  29.             textFlow.addChild(p);
  30.  
  31.             textFlow.flowComposer.addController(new DisplayObjectContainerController(this,400,200));
  32.             textFlow.flowComposer.updateAllContainers();
  33.         }
  34.  
  35.        
  36.     }        
  37. }
Advertisement
Add Comment
Please, Sign In to add comment