Changing Font Style in the following code to "Verdana", including size & color attributes

Posted on 2006-07-09
Last Modified: 2013-12-03
Hello Fellow Experts,

This is in reference to the following question...

My text comes out Times Roman and the color is blue.  I would like to modify the font, color, and size.  View the accepted comment for the working code.
Here is the link to my Flash animation;

What do I need to change?

Thank you,

Question by:irwinpks
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
LVL 37

Accepted Solution

CyanBlue earned 500 total points
ID: 17069532
Well...  That's where you have to specify it within the TextFormat object...  

First of all, add the font line like this...

var _tf = new TextFormat();
_tf.font = "Verdana";
_tf.color = 0x0000FF;
_tf.size = 14;

If you need to change the color, it's the line that says color, and the same goes to the size as you can easily guess...  ;)

No, we're not done yet...
Open up the Library panel...
Click on the menu on the right top corner of the panel and select New Font and set it like this...
   Name : Verdana
   Font : Verdana
You should see the Verdana in the library as a newly created item...
Right click on that and select Linkage...
Select the first item, Export for ActionScript, and hit OK button...

Test movie and your font is embedded properly...

Let me know...  :)

LVL 30

Author Comment

ID: 17069792
cool..will work on this later tonight.  thank you!
LVL 30

Author Comment

ID: 17070252
Looking good so far...

This line...
_mc.createTextField("name_txt", theDepth++, 0, imgH + gap, imgW, 20);

where the position of the text (firstname & lastname) is can we make it centered?  I was thinking taking the length of the first name + lastname, and divide by 2..take the integer of that and add it to the above line.

how can we do this?
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

LVL 30

Author Comment

ID: 17070253
Oh the above link...I changed the font to Trebuchet MS.
LVL 37

Expert Comment

ID: 17072058
Check on the TextFormat.align in the Flash manual...  That's what you are looking for...  ;)

LVL 30

Author Comment

ID: 17075082
Ok..I don't have my Flash book in front of me.  However, I checked this out;

...and stuck the following line in
 _tf.align = "center";

 var _tf = new TextFormat();
_tf.font = "Trebuchet MS";
_tf.color = 0xffcc00;
_tf.size = 12;
_tf.align = "center";



LVL 30

Author Comment

ID: 17075091
This is the LAST component to this animation...


Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question