3 Replies Latest reply on Jan 28, 2013 12:22 PM by kglad

    Why set setTextFormat everytime text changes?

    rokosz

      Originally this request was going to be re: setTextFormat having no effect on font size etc.

       

      In preparing this question I found that those attribs are working fine, just not sticking

       

      the following snippet function is called everytime a user changes pictures in a slide show

      I had to add the 4th stmt re setTextFormat in order to keep the text from reverting/becoming Times Roman size 12.

       

      I tried using defaultTextFormat  but had no effect (perhaps becuase its only avail in AS3?)

       

      Is this something I've got to shoulder everytime I change the text of a textfield?  Is there now way to define the style of the textfield and make they style "permanent"?

       

      thanks folks, Bryan

       

      <code>

      function picture_num() {
      current_pos = p+1;
      txtPicEnumeration.text =  current_pos+" of "+total;
      txtPicEnumeration.setTextFormat(0,12,myformat)

      }

      </code>

       

      <code>

      var myformat:TextFormat = new TextFormat();
      myformat.font="Courier";
      myformat.bold=true;
      myformat.size=15

       

      createTextField("txtPicEnumeration",this.getNextHighestDepth(),100,600,218,46);

      txtPicEnumeration.textColor= 0xFF0000;  //works
      txtPicEnumeration.border = true;     // works
      txtPicEnumeration.borderColor=0xFF0000;  // works
      txtPicEnumeration.setTextFormat(new TextFormat())
      txtPicEnumeration.text = "XXXXX"
      txtPicEnumeration.setTextFormat(0,12,myformat); 
      // above stmt works -- but doesnt stick when picture_num() is called

      </code>