Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 261917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:28:19+00:00 2026-05-11T22:28:19+00:00

Because I want to avoid repetitive code, and I’m using a lot of text

  • 0

Because I want to avoid repetitive code, and I’m using a lot of text formats, I created a CustomTextFormat class in Flex Builder.

Another class, called CustomInputBox.as is using this object to create a format:

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);
        }
    }
}

The code of CustomTextFormat is as follows:

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;
        }
    }
}

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?):

1067: Impliciete afgedwongen omzetting van een waarde van het type
CustomTextFormat in een niet-gerelateerd type flash.text:TextFormat.
CustomInputBox.as

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.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:28:19+00:00Added an answer on May 11, 2026 at 10:28 pm

    Something’s wacky here. If you want to assign your custom format like this:

    var format:CustomTextFormat = new CustomTextFormat();
    inputBox.defaultTextFormat = format;
    

    Then CustomTextFormat needs to extend TextFormat, and the code in CustomTextFormat’s constructor should be modifying the inherited TF properties. Alternately, if you want to leave CustomTextFormat extending Sprite, then you need to change CustomTextFormat’s “format” property to be a public property, and change your assignment to something like:

    var customFormat:CustomTextFormat = new CustomTextFormat();
    inputBox.defaultTextFormat = customFormat.format;
    

    Does that make sense? Right now you’re trying to set the input’s default text format to a class object that extends Sprite. And the inputBox doesn’t know anything about CustomTextFormat’s internal “format” property, which is both private and temporary.

    (Incidentally none of this precisely explains the error message you’re getting, but in my experience it’s somewhat rare for Flash compiler errors to really tell you what’s wrong… they tend to claim you’re using classes illegally when all you did is leave out a semicolon. I tend not to trust the error messages too much.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a set because, i want to use the quick look up
Hopefully a picture is worth a thousand lines of code because I don't want
I don't want to use the HTTP::Proxy package because I want to dump out
I'm currently convering my ASP.NET v2 application to serialize/deserialize it's objects because I want
I want that list, because if something horrible happens, and I'll have to reinstall
I want to exclude a subdirectories by pattern in subversion because the development tool
I want to use a case statement in my user-defined functions because I need
I want to cancel this operation if the user selects a specific item because
I want to create my Rails application with MySQL, because I like it so
I want to disable Javascript once a page has already loaded. Why? Because I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.