3

I am having trouble changing the font size for the flash component, text input. This text input component is already ready made where you can find it in components. So i just drag and drop it onto the stage. However, the font size is too small. And I can't change it. Or do I need to change it through coding in AS3? Thank you!

Apple.
  • 117
  • 2
  • 4
  • 12
  • Ah, I didn't know that I was supposed to do that until now. I will do that from now onwards :) Thanks for reminding! – Apple. Oct 23 '13 at 16:29
  • Oh wow. Thanks for the information :) Yes, your answer did help me. It works like magic! :) – Apple. Oct 23 '13 at 16:49

2 Answers2

2

You can set TextInput' style this way:

var format:TextFormat = new TextFormat();
format.size = 18; // your value here
instanceName.setStyle("textFormat", format);

Read more about TextFormat: link.

Ivan Chernykh
  • 41,617
  • 13
  • 134
  • 146
2

You can change the text style for all instances of TextInput from one place, so whenever you drag a new TextInput component from Components panel and drop it on the stage, it will use your custom text style by default:

import fl.managers.StyleManager;
import fl.controls.TextInput;

var tf:TextFormat = new TextFormat();
tf.size = 20;
StyleManager.setComponentStyle(TextInput, "textFormat", tf);

Furthermore, you can set the text style of all components (not just TextInput) from one place if you like to make all of them with the same style; this will give a better look especially if you have also changed the font family:

import fl.managers.StyleManager;
import fl.controls.TextInput;

var mainTF:TextFormat = new TextFormat();
mainTF.font = "Arial Black";
mainTF.color = 0xFF0000; 
mainTF.size = 20;
StyleManager.setStyle("textFormat", mainTF); 

Please tell me if you need further help.

Amer
  • 468
  • 1
  • 5
  • 15