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

  • SEARCH
  • Home
  • 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 7950691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:21:02+00:00 2026-06-04T02:21:02+00:00

here are 2 code blocks. var myTextField:TextField = new TextField(); var myTextFormat:TextFormat = new

  • 0

here are 2 code blocks.

var myTextField:TextField = new TextField();
var myTextFormat:TextFormat = new TextFormat();

addChild(myTextField);

myTextFormat.font = "Arial";
myTextFormat.size = 15;
myTextFormat.color = 0x0000FF;

myTextField.text = "some text";
**myTextField.setTextFormat(myTextFormat);**

VS

var myTextField:TextField = new TextField();
var myTextFormat:TextFormat = new TextFormat();

addChild(myTextField);

myTextFormat.font = "Arial";
myTextFormat.size = 15;
myTextFormat.color = 0x0000FF;

**myTextField.defaultTextFormat = myTextFormat;**

So , What’s the difference between
setTextFormat() and defaultTextFormat ? Why two different ways ( one by property another by method) to do things.

Tested with some more code :

var my_txt:TextField =new TextField();
    my_txt.type = TextFieldType.INPUT
     var my_fmt:TextFormat = new TextFormat();
     my_fmt.color = 0xFF0000;

     my_txt.text = "this is for setTextFormat with range";
     my_txt.setTextFormat(my_fmt,0,3);

    // my_txt.text = "this is for setTextFormat without range";
    // my_txt.setTextFormat(my_fmt);

    // my_txt.defaultTextFormat = my_fmt;
    // my_txt.text = "this is for default text format";

    addChild(my_txt);

V.

  • 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-06-04T02:21:03+00:00Added an answer on June 4, 2026 at 2:21 am

    setTextFormat allows you to change the formatting on parts of the text. Check out the other two parameters of setTextFormat. When you set defaultTextFormat it is applied to all the text that you add to the TextField.

    More info :

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#defaultTextFormat

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#setTextFormat

    Edit :
    Also setTextFormat doesn’t work on text that is inserted after you set the format. Adobe says
    “Any text inserted manually by the user, or replaced by the replaceSelectedText() method, receives the default text field formatting for new text, and not the formatting specified for the text insertion point. To set the default formatting for new text, use defaultTextFormat.”

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

Sidebar

Related Questions

Here is my code snippet where I'am taking confidence with initialization blocks class Father{
I'm using code similar to below: var image = new Image(); image.src = http://youtube.com/favicon.ico;
Here's code from https://github.com/Khan/khan-exercises/blob/master/khan-exercise.js for ( var i = 0; i < loading; i++
here is my code: $(a).live('click', function(){ history.pushState({}, '', this.href); popstate(this.href); $(#loadpage).css(display, block); return false;
Ok the error is showing up somewhere in this here code if($error==false) { $query
Here is code from MSDN . I don't understand why the work isn't just
Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
here is code for regular expression matching #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int
Here is code example class A{ int i; public: A(int i) : i(i) {}
enter code here I have a table on SQL server 2005 with bigint primary

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.