Flash load external text set color problem

Source: Internet
Author: User
Tags html tags modify
Problem

In Flash, the use of dynamic text to external TXT document is relatively simple, the advantage is that the text is easy to modify, today, someone asked how to change the text from the TXT document loading flash color. In fact, there are many methods, such as in the dynamic text of the property bar (pictured)




Of course, such a modification method has to open the Flash source file, more trouble, in fact, there is a simple way, is the use of HTML tags in txt, which is also a group of friends to ask. The following are specific practices:

1. Create a new flash document.

2. In the first frame write as:

System.usecodepage=true this sentence is mainly to prevent garbled.

3. Create a new MC. Create the dynamic text with the instance named Cont in the MC. As shown in figure




Notice that in the property bar of the dynamic text, you must select the "Render text as HTML" item, as shown in the second button



4. On the MC just created, write as

Onclipevent (load) {
This.loadvariables ("News.txt");
}
Loading a text file named News.txt
Onclipevent (data) {
Cont.htmltext = txt;
/*
Display the document after "txt=" in the text file in dynamic text with the instance named cont
*/
}5. In the flash created above, create a text file named News.txt in the same directory (note that you want to save it as a Unicade format), which reads as follows:

Txt=<font color= "#99CC00" > Two midgets. Late at night, a dwarf hears another dwarf in the next room </p><p> keeps saying: "123, hey. 123, Hey ^ ^^". The next morning, the two of them talked, and the dwarf said to the other </p><p>: "You are diligent, you are exercising all night." Another said: "Grandma's, what exercise </p><p> body ah, I have not jumped to bed all night!" </font>6. Done, so you can modify the font color in the text.

Many people load external text with a dynamic text instance name. text, but it does not support HTML tags, so if you use HTML tags in text, you use the dynamic text instance name. HTMLText.

Note: The HTML tags that flash can support are very limited.

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.