title: How can I prevent this arbitrary text truncation in AS3
body: <p>Below is code that populates a menu. Everything seems to work great, with no errors thrown, except for one crucial part. My <code>megaPages</code> array has the values <code>["HOME","BABIES","BRIDALS","MISC","WEDDINGS","ABOUT"]</code>, but the actual text that displays on screen (which is produced by megaPages) is like this:</p>
  
  <p><img src="https://i.stack.imgur.com/3bAsq.jpg" alt="strange menu problems"></p>
  
  <p>As you can see, some of the text is arbitrarily being truncated. I've traced the text strings as they get passed through the various functions at various stages of the menu-build, and they are always right, but somehow when each DisplayObject make it on screen, letters get ommitted (notice though that 'HOME' abd 'ABOUT' are fine). I don't even know where to start with this problem.</p>
  
  <pre><code>    function buildMenu() {
          var itemMCs = new Array();
  
          for (var i = 0; i &lt; megaPages.length; i++) {
              megaPages[i] = megaPages[i].toUpperCase();
              trace(megaPages[i]); // at each iteration, traces as follows "HOME","BABIES","BRIDALS","MISC","WEDDINGS","ABOUT"
              var textMC = createText(megaPages[i]);
  
              var itemMC = new MovieClip();
              if (i!=0) {
                  var newLink = new PlateLink();
                  newLink.y = 0;
                  itemMC.addChild(newLink);
              }
  
  
              var newPlate = new Plate();
              if (i==0) {
                  newPlate.y = 0;
              } else {
                  newPlate.y = newLink.height - 2;
              }
              newPlate.x = 0;
              newPlate.width = textMC.width + (plateMargin*2);
              itemMC.addChild(newPlate);
  
              if (i!=0) {
                  newLink.x = (newPlate.width/2) - (newLink.width/2);
              }
  
              textMC.x = plateMargin;
              textMC.y = newPlate.y + .5;
              itemMC.addChild(textMC);
  
              itemMCs.push(itemMC);
  
              itemMC.x = (homeplateref.x + (homeplateref.width/2)) - (itemMC.width/2);
              if (i==0) {
                  itemMC.y = homeplateref.y;
              } else {
                  itemMC.y = itemMCs[i-1].y + (itemMCs[i-1].height - 6);
              }
              menuRef.addChild(itemMC);
  
          }
  
      }
  
      function createText(menuTitle) {
  
          trace(menuTitle);
  
          var textContainer : MovieClip = new MovieClip();
  
          var myFont = new Font1();
  
          var backText = instantText(menuTitle, 0x000000);
  
          backText.x = 1;
          backText.y = 1;
  
          var frontText = instantText(menuTitle, 0xFFFFFF);
  
          frontText.x = 0;
          frontText.y = 0;
  
          textContainer.addChild(backText);
          textContainer.addChild(frontText);
          return textContainer;
      }
  
      function instantText(textContent, color) {
  
          trace(textContent); // again, traces the right text each time it is fired
  
          var myFont = new Font1();
          var myFormat:TextFormat = new TextFormat();
          myFormat.size = 18;
          myFormat.align = TextFormatAlign.CENTER;
          myFormat.font = myFont.fontName;
  
          var myText:TextField = new TextField();
          myText.defaultTextFormat = myFormat;
          myText.embedFonts = true;
          myText.antiAliasType = AntiAliasType.ADVANCED;
          myText.text = textContent;
          myText.textColor = color;
          myText.autoSize = TextFieldAutoSize.LEFT;           
          trace(myText.text);
  
          return myText;
      }
  </code></pre>