11 Replies Latest reply on May 16, 2009 5:34 AM by Michael Borbor

    tlf

    thesteelmam

      hi all

      how r u

      how can i use TLF (text layout framework) with various components like datagrid, combobox or lists ?

      are there any ways to do this ?

      thanx

        • 1. Re: tlf
          Michael Borbor Level 4

          Read this great tutorial at InsideRIA

           

          http://www.insideria.com/2009/03/flash-text-engine.html

          1 person found this helpful
          • 2. Re: tlf
            thesteelmam Level 1

            thank you very much

            this is great article and was very useful

            but i want to know if the following is pissible or not

            i want to use tlf as the text properties for components for example textbox1.text=some text treated with tlf

            any help?

            thanx

            • 3. Re: tlf
              Barna Biro Level 3

              If I'm not mistaking then TLF will be available with Flex 4. Current Flex 3.x components don't support it. Try downloading the free Flex 4 SDK ( it's in beta at the moment ) and play around with it, at least you'll know how to prepare for the future.

               

              With best regards,

              Barna Biro

              Blog: http://blog.wisebisoft.com

              • 4. Re: tlf
                Michael Borbor Level 4

                Sure you just need to go to labs.adobe.com from there you van download 

                the TLF, and you'll also find instructions on how to use with Flex3. 

                Actually you can download the New York Times Reader App that was just 

                release using TLF.

                 

                Sincerely,

                 

                Michael

                 

                El 13/05/2009, a las 6:16, thesteelmam <forums@adobe.com> escribió:

                 

                >

                thank you very much

                this is great article and was very useful

                but i want to know if the following is pissible or not

                *i want to use tlf as the text properties for components for example 

                textbox1.text=some text treated with tlf*

                any help?

                *thanx

                *

                >

                • 5. Re: tlf
                  thesteelmam Level 1

                  i know how to use it really

                  but i want to use it with flex controls like buttons and datagrids or lists

                  can i do that?

                  • 6. Re: tlf
                    thesteelmam Level 1

                    i was there from many hours really it is the best source of informations about flex

                    but iam asking about the ability using tlf with controls

                    thank you too much

                    • 7. Re: tlf
                      Michael Borbor Level 4

                      Currently not, you have to use the TLF components.

                       

                      Here's another great article about it.

                       

                      http://www.adobe.com/devnet/flex/articles/text_layout_framework_print.html

                       

                      Sincerely,

                       

                      Michael

                      1 person found this helpful
                      • 8. Re: tlf
                        thesteelmam Level 1

                        hi

                        thank you for ur help

                        the article is great, to reach my goal i used this idea :

                        package Models
                        {
                             import flash.events.Event;
                             import flash.text.engine.ElementFormat;
                             import flash.text.engine.FontDescription;
                             import flash.text.engine.TextBlock;
                             import flash.text.engine.TextElement;
                             import flash.text.engine.TextLine;
                             
                             import flashx.textLayout.formats.TextAlign;
                             
                             import mx.controls.Label;
                             import mx.events.FlexEvent;
                                     
                             public class myLabel extends Label
                             {
                                  private var _text:String;
                                  
                                  public function myLabel()
                                  {
                                       super()
                                       addEventListener(FlexEvent.VALUE_COMMIT,Text)
                                  }
                                  public function get myText():String{
                                       return _text;
                                  }          
                                  private function Text(event:Event) : void{
                                       if(text!=""){
                                            var fd:FontDescription = new FontDescription("Tahoma","normal","normal","device","cff","horizontalStem");               
                                            var ef:ElementFormat = new ElementFormat(fd);
                                            ef.fontSize=10;
                                            ef.color=584625;
                                            var te:TextElement = new TextElement(text, ef);
                                            var tb:TextBlock = new TextBlock();
                                            tb.content = te;
                                            var tl:TextLine = tb.createTextLine(null, 200);
                                            tl.x=width/2-tl.width/2;
                                            tl.y=height/2-tl.height/2;                    
                                            _text=text;
                                            text=""
                                            addChild(tl);
                                       }          
                                  }
                             }
                        }
                        

                        this is for labels and it worked well, for grids or listbase controls i set itemrenderer property to the new label class also for textinput i can use textflow component, the problem now in othe components like tabs or accordions how can i set its labels to my class or even replace its labels with tlf text?

                        another question plz : how can i make the direction of TextLine right-to-left ? in textflow there is property to do this ...

                        thanx alot

                        • 9. Re: tlf
                          Michael Borbor Level 4

                          In that case you can do the same thing that you did with label but 

                          extending the AccordionHeader and so on.

                           

                          Sincerely,

                           

                          Michael

                           

                          El 14/05/2009, a las 8:30, thesteelmam <forums@adobe.com> escribió:

                           

                          >

                          hi

                          thank you for ur help

                          the article is great, to reach my goal i used this idea :

                          package Models

                          {

                               import flash.events.Event;

                               import flash.text.engine.ElementFormat;

                               import flash.text.engine.FontDescription;

                               import flash.text.engine.TextBlock;

                               import flash.text.engine.TextElement;

                               import flash.text.engine.TextLine;

                          >

                               import flashx.textLayout.formats.TextAlign;

                          >

                               import mx.controls.Label;

                               import mx.events.FlexEvent;

                          >

                               public class myLabel extends Label

                               {

                                    private var _text:String;

                          >

                                    public function myLabel()

                                    {

                                       & nbsp; super()

                                       & nbsp; addEventListener(FlexEvent.VALUE_COMMIT,Text)

                                    }

                                    public function get myText():String{

                                       & nbsp; return _text;

                                    }

                                    private function Text(event:Event) : void{

                                       & nbsp; if(text!=""){

                                       & nbsp;      var fd:FontDescription = new 

                          FontDescription(

                          "Tahoma","normal","normal","device","cff","horizontalStem");

                                       & nbsp;      var ef:ElementFormat = new 

                          ElementFormat(fd);

                                       & nbsp;      ef.fontSize=10;

                                       & nbsp;      ef.color=584625;

                                       & nbsp;      var te:TextElement = new TextElement(text, 

                          ef);

                                       & nbsp;      var tb:TextBlock = new TextBlock();

                                       & nbsp;      tb.content = te;

                                       & nbsp;      var tl:TextLine = tb.createTextLine(null, 

                          200);

                                       & nbsp;      tl.x=width/2-tl.width/2;

                                       & nbsp;      tl.y=height/2-tl.height/2;  & 

                          nbsp;            &nb sp;

                                       & nbsp;      _text=text;

                                       & nbsp;      text=""

                                       & nbsp;      addChild(tl);

                                       & nbsp; }

                                    }

                               }

                          }

                          >

                          this is for labels and it worked well, for grids or listbase 

                          controls i set itemrenderer property to the new label class also for 

                          textinput i can use textflow component, the problem now in othe 

                          components like tabs or accordions how can i set its labels to my 

                          class or even replace its labels with tlf text?

                          thanx alot

                          >

                          • 10. Re: tlf
                            thesteelmam Level 1

                            hi thank you for ur usefull ideas it helped me too much

                            thanx

                            • 11. Re: tlf
                              Michael Borbor Level 4

                              You're welcome.