title: Flash/Flex error 1067: can't make a custom TextFormat object?
body: <p>Because I want to avoid repetitive code, and I'm using a lot of text formats, I created a CustomTextFormat class in Flex Builder.</p>
  
  <p>Another class, called CustomInputBox.as is using this object to create a format:</p>
  
  <pre><code>package
  {
      import flash.display.Sprite;
      import flash.text.TextField;
      import flash.text.TextFieldType;
  
      public class CustomInputBox extends Sprite
      {
          public function CustomInputBox(xLoc:int, yLoc:int, width:uint, height:uint, password:Boolean = false, text:String = "", font:String = "Arial", fontColor:uint = 0x000000, fontSize:uint = 18, fontBold:Boolean = false)
          {
              var inputBox:TextField = new TextField();
              inputBox.type = TextFieldType.INPUT;
              inputBox.mouseEnabled = true;
              inputBox.selectable = true;
              inputBox.multiline = false;
              inputBox.x = xLoc;
              inputBox.y = yLoc;
              inputBox.width = width;
              inputBox.height = height;
              inputBox.displayAsPassword = password;
              var format:CustomTextFormat = new CustomTextFormat();
              inputBox.defaultTextFormat = format;
              inputBox.text = text;
              addChild(inputBox);
          }
      }
  }
  </code></pre>
  
  <p>The code of CustomTextFormat is as follows:</p>
  
  <pre><code>package
  {
      import flash.display.Sprite;
      import flash.text.TextFormat;
      import flash.text.TextFormatAlign;
  
      public class CustomTextFormat extends Sprite
      {
          public function CustomTextFormat(font:String = "Arial", fontColor:uint = 0x000000, fontSize:uint = 18, fontBold:Boolean = false, fontAlign:String = TextFormatAlign.LEFT)
          {
              var format:TextFormat = new TextFormat();
              format.font = font;
              format.color = fontColor;
              format.size = fontSize;
              format.bold = fontBold;
              format.align = fontAlign;
          }
      }
  }
  </code></pre>
  
  <p>Now, I'm getting error 1067 in the CustomInputBox.as file, it's a Dutch error unfortunately (any way to set flex errors to english?):</p>
  
  <blockquote>
    <p>1067: Impliciete afgedwongen omzetting van een waarde van het type
    CustomTextFormat in een niet-gerelateerd type flash.text:TextFormat.
    CustomInputBox.as</p>
  </blockquote>
  
  <p>It's difficult to translate, but hopefuly the error number and the code are enough to identify my problem. I'm new to Flash, and searched but couldn't find out what I am doing wrong.</p>
  
  <p>Thanks in advance.</p>