Solved

Flash Dynamic text font change

Posted on 2009-04-10
3
705 Views
Last Modified: 2013-11-11
Upon clicking a button, i want to change the text size of a dynamic text field within a flash document.  Below shows the following code i already have but this does not work.

thanks if you can help!
var format:TextFormat = new TextFormat();

            format.font = "trebuchet";

            format.color = 0xFF0000;

            format.size = 15;

            format.underline = true;
 

            txt_desc.defaultTextFormat = format;

Open in new window

0
Comment
Question by:Sky23
3 Comments
 
LVL 4

Accepted Solution

by:
Drakkon earned 250 total points
ID: 24119844
Have you made sure to embed the trebuchet font in the library in the size and style you are wanting to use?

http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/
0
 
LVL 8

Assisted Solution

by:wal_toor
wal_toor earned 250 total points
ID: 24137432
Hello Sky,

You were on the right track. But your assingment of the textformat to the textfield was wrong. Try this piece of script.

greetz,
walter
var format1:TextFormat = new TextFormat();

var format2:TextFormat = new TextFormat();
 

// function 1 to change font
 

function changeToFont1(){

	format1.font = "trebuchet";

	format1.color = 0x990000;

	format1.size = 15;

	format1.underline = true;

	txt_desc.setTextFormat(format1);

}
 

// function 2 to change font
 

function changeToFont2(){

	format2.font = "Arial";

	format2.color = 0xFF9900;

	format2.size = 25;

	format2.underline = false;

	txt_desc.setTextFormat(format2);

}
 

// call these functions on a button
 

changeToFont1();

//changeToFont2();

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now