Skip navigation
Currently Being Moderated

setTextFormat(format1);

Apr 30, 2012 11:05 AM

The below code is inside _root.contents.text_mc

 

I want to create a text field in _root.contents and when addText1 is clicked to change to format1. This is my code. It's not working. Can someone help fixing this?

 

var format1:TextFormat = new TextFormat();

format1.bold = true;

format1.color = 0xFFFFFF;

format1.size = 12;

format1.font = "Font1";

 

_root.contents.createTextField("newszlatest", this.getNextHighestDepth(), 0, 0, 0, 0);

_root.contents.newszlatest.multiline = true;

_root.contents.newszlatest.wordWrap = true;

_root.contents.newszlatest.textColor = 0xFF6600;

 

_root.contents.txtool_mc.droFonts_mc.font_mc.addText1.onRelease=function(){

          _root.contents.newszlatest.html=true;

     //trace ("Test...");

          _root.contents.newszlatest.setTextFormat(format1);

           _root.contents.newszlatest.embedFonts = true;

          

          createTF(scrollup._x+tl.scrollup._width/2,scrollup._y,"");

          ft1.textColor = "0x666666"

          for (k=1; k<13; k++) {

          _root.contents.txtool_mc["ftI"+k]._visible=false;

}

}

 
Replies
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 30, 2012 1:01 PM   in reply to Ron Colmen

    i don't see any text assigned to newszlatest.  if there is none assigned until after you assign formatting, use setNewTextFormat(format1);

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 30, 2012 2:22 PM   in reply to Ron Colmen

    if you're going to embed fonts for a dynamically created textfield, you need to assign a font (that's in your library and marked for export with actionscript).

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points