Flash embed fonts-embedding the font when creating text dynamically _ solves the problem of _ rotation and _ alpha unavailability

Source: Internet
Author: User

From: http://www.webstudio.com.cn/blog? P = 68
Too handsome. I couldn't think of Thank Goodness that helped me find a solution to the problem of _ rotation and _ alpha unavailability at midnight!
When creating text dynamically, you will always encounter the problem of embedding fonts. The most common problem is the link ID.
Generally, you need to create a new font in the library. For example, you can select the o4b_08 font and name the base name 04b_08, so that the font can be created. But one step is always easy to forget. We also need to select the font in the library, right-click the link, and select export as the Action Script. The name is also named o4b_08. In this way, you can successfully embed the dynamically created text in the font. Then add the Code:

This. createTextField ("my_text", this. Fig (), 100,100,300,100 );
My_text.text = "welcome to egoldy flashblog ";

Var my_fmt: TextFormat = new TextFormat ();
My_fmt.color = 0xff0000;
My_fmt.align = "center ";
My_fmt.size = 8;
My_fmt.font = "04b_08 ";
My_text.setTextFormat (my_fmt );
My_text.embedFonts = true;
//*****************************
My_text. _ alpha = 50;
My_text. _ rotation = 90;
//*****************************

You may already know the reason for adding the * line. When we do not use the embedded font method, these two lines will not take effect in any way, which is also the reason why I have encountered problems more or less. If you use the above method to embed the font. You will find that these two lines can take effect. You can add other attributes to the dynamically created font.
Btw: I used a variety of fonts for the test, and the size of the result file has increased a lot. If you use Chinese, it will be larger. It is estimated that the problem may have been solved by flash 8 ball.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.