Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Flash Dynamic text font change

Posted on 2009-04-10
3
Medium Priority
?
714 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
[X]
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
3 Comments
 
LVL 4

Accepted Solution

by:
Drakkon earned 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

670 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