3 Replies Latest reply on May 16, 2010 5:06 AM by Ned Murphy

    Question about textField

    jacky_38

      Hi, everyone,

      I got a problem on set Front style

       

       


      var statusTextField:TextField = new TextField();
      var style:StyleSheet = new StyleSheet();
      var heading:Object = new Object();
      heading.fontWeight="bold";
      heading.fontFamily="Magneto";
      heading.color="#000000";
      heading.fontSize = 72;

      style.setStyle(".heading", heading);

      statusTextField.text = "You have seconds to write your response.";
      statusTextField.styleSheet=style;
      statusTextField.autoSize=TextFieldAutoSize.LEFT;
      addChild(statusTextField);

       

       

      I don`t know where is the problem is,

      The text is on the layer,

      but the font style is not the one I want,

      it just used the standard text style
      Can anyone help me???

        • 1. Re: Question about textField
          Ned Murphy Adobe Community Professional & MVP

          A few things... styles are associated with html, so that's one aspect you're missing (htmlText).  And like html code, your styles are prescribed via the tag parameters (span class).   And you should assign the styles for the textfield before you assign the text.

           

          statusTextField.styleSheet=style;
          statusTextField.htmlText = "<span class='heading'>You have seconds to write your response.</span> ";

          • 2. Re: Question about textField
            jacky_38 Level 1

            Thanks for your reply!!!!!!!!!!!

            I can do it !!

             

            But I have another question is that how can I set the word field seperate in 2 line if the wordfield is longer than the stage?

            • 3. Re: Question about textField
              Ned Murphy Adobe Community Professional & MVP

              Then you will want to assign the wordWrap and the width properties of your textfield as well.  You should read thru the TextField class in the Flash help documents to become familiar with all of the properties and methods (etc) that support it.