3 Replies Latest reply on Dec 7, 2006 6:42 AM by kglad

    textformat obj being ignored

    s-atoms
      Can anybody see why the following text formatting obj is not being applied to my text fields?

      This code is in frame 1 of my _root movie & is called from within a couple nested movie clips with the following script

      // Array to store text
      var aText:Array = new Array;
      var nHeight:Number = 15;

      // Add blinking cursor movieclip
      var mcRef:MovieClip = this.attachMovie("mcCursor", "mcCursor", this.getNextHighestDepth(), {_x:6, _y:7});
      aText.push("blah blah testing etc");
      _root.teleType(this, 0, "0xCCFFFF");

      I've tried embedding the Verdana font (and obv changing the font name to the linkage name) but this has no effect.
      I've also tried including a dynamic text field on the root stage with embedded characters.

      Neither makes any difference - a default font is used, with default colour & size.

      Any ideas?


      //*************************************************************************
      // Teletype printing functions ********************************************
      //*************************************************************************

      //Text formatting object
      var tfText:TextFormat = new TextFormat();
      tfText.font = "Verdana";
      tfText.size = 8;
      tfText.align = "left";
      //tfText.underline = false;

      import flash.filters.GlowFilter;
      var gfObj:GlowFilter = new GlowFilter(0x000000, .5, 40, 20);

      function teleType(mcRef:MovieClip, nLine:Number, sColour:String):Void
      {
      var nY:Number = nLine * mcRef.nHeight + 8;
      txtRef = mcRef.createTextField("txt"+nLine, mcRef.getNextHighestDepth(), 10, nY, 10, 10);
      txtRef.setTextFormat(tfText);
      txtRef.embedFonts = true;
      // txtRef.filters = [gfObj];
      txtRef.ind = 0;
      txtRef.line = nLine;
      txtRef.autoSize = "left";
      // txtRef.textColor = sColour;
      txtRef.selectable = false;
      txtRef.intRef = setInterval(printText, 100, txtRef, mcRef, sColour);
      }

      function printText(tRef:Object, tgtRef:MovieClip, sColour:String):Void
      {
      var nLine:Number = tRef.line;
      var nIdx:Number = tRef.ind + 1;
      tRef.text = tgtRef.aText[nLine].substr(0, nIdx);
      tgtRef.mcCursor._x = tRef._x + tRef._width;
      tgtRef.mcCursor._y = tRef._y + 5;
      if (nIdx !== tgtRef.aText[nLine].length)
      {tRef.ind = nIdx;}
      else
      {
      clearInterval(tRef.intRef);
      if (++nLine !== tgtRef.aText.length)
      {
      teleType(tgtRef, nLine, sColour);
      }
      }
      updateAfterEvent;
      }

      //*************************************************************************