2 Replies Latest reply on Jun 3, 2008 12:34 AM by StrangeHeart

    font coding problem

    StrangeHeart
      Hi
      I am hving pb in coding
      1- I need the font to be align to center.
      2- I need how to code the font family e.g "Arial" etc...

      // here i hve given the family font but it does not work

      myFormat.size = 25;
      myFormat.font = ("fontfamily", "Arial");

      //end


      i have put the coding below, pls do chck in help me in it.

      Thnks
      ===========================

        • 1. Re: font coding problem
          clbeech Level 3
          when using a TextFormat Object, you should write:

          myFormat.size = 25;
          myFormat.font = 'Arial';
          myFormat.align = 'center';

          and when setting the format to the textField you do not need to call _root since the TextFormat Object is within this scope.

          I also see that you have not 'declared' the TextFormat Object here previous to setting the properties, as in:

          var myFormat = new TextFormat();

          you can also set the color property within the format Object, however in either method (eg. the textField.color property) you need to use a hexadecimal number, as in:

          myFormat.color = 0xFF0000; //color is red

          • 2. Re: font coding problem
            StrangeHeart Level 1
            Hi
            Thanks it is working now fine
            I appricatie ur help.

            Bye
            ----------------------------------------------

            quote:

            Originally posted by: clbeech
            when using a TextFormat Object, you should write:

            myFormat.size = 25;
            myFormat.font = 'Arial';
            myFormat.align = 'center';

            and when setting the format to the textField you do not need to call _root since the TextFormat Object is within this scope.

            I also see that you have not 'declared' the TextFormat Object here previous to setting the properties, as in:

            var myFormat = new TextFormat();

            you can also set the color property within the format Object, however in either method (eg. the textField.color property) you need to use a hexadecimal number, as in:

            myFormat.color = 0xFF0000; //color is red