2 Replies Latest reply on Mar 1, 2010 12:12 AM by Patel Bharat

    Font family on TextRange content !!

    Patel Bharat Level 2

      Hi Friends,


      I am facing one problem regarding apply Embed Font on TextRange content. I want to apply an embeded font on the selected text of a TextArea.


      Thanks In Advance



      Below is the sample code.



      <?xml version="1.0" encoding="utf-8"?>




      xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">






      @font-face {







      src: url("/assets/KAP001.TTF");


      fontFamily: KAP001;


      advancedAntiAliasing: true;














      import mx.controls.textClasses.TextRange;


      private function onChangeFontClick(event:MouseEvent ):void




      var _textRange:TextRange = new TextRange(txt, true, 0, 5);

      _textRange.fontSize = 10

      _textRange.fontFamily =












      <mx:TextArea width="400" id="txt" text="THIS IS TEST TEXT" fontSize="20" />



      <mx:Button label="CHANGE FONT FAMILY" click="onChangeFontClick(event)"/>