Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Color of Text in a Text Field

Status
Not open for further replies.

GGROD

Programmer
Feb 7, 2002
68
US
I'm having a text box with scroll bar point to an external txt file for it's contents. In part of the txt file I have a web link. I'd like to make this a different color than the other text.

Here are the contents of my txt file named "ScrollBar_Text.txt":

&Title=Scroll Bar with Text File&

&myText=<b>Scrollable Text field with Exteral File</b>
This example shows you how to use a scrollbar with external text - in a text file. The important thing to remember is not to give your Text Field a variable Name. But make sure to give it an Instance name. This is the biggest difference between Flash 5 and MX when using text fields and components.
<b>Using Style's and Formats</b>
The Code also goes over how to use Style's and formats to change just about everything having to do with your ScrollBar and dynamic Text field.
<b>Example HTML Formatting</b><br>
<b>Bold</b> - tags shown in source.
<i>italic</i> - tags shown in source.
<a href=&quot; target=&quot;_blank&quot;>URL Link</a>


Here is the action script code I have in Frame 1:

myData = new LoadVars();

myData.onLoad = addItems;

myData.load(&quot;Files/ScrollBar_Text.txt&quot;);

function addItems() {

// Set the Title from Text File.
Title = myData.Title;

myText.multiline = true;
myText.wordWrap = true;
myText.type = &quot;dynamic&quot;;
myText.background = true;
myText.backgroundColor = &quot;0x000000&quot;;
myText.border = false;
myText.html = true;

myText.htmlText = myData.myText;
ScrollBar.setScrollTarget(myText);


textFormat = new TextFormat();
textFormat.color = &quot;0xffffff&quot;;
textFormat.bullet = false;
textFormat.underline = false;
textFormat.bullet = false;
textFormat.size = 11;
textFormat.font = &quot;arial&quot;;

myText.setTextFormat(textFormat);
}

Would really just like to chang the color of the text enclosed in the &quot;<a href=&quot; tags in the text file.

Rod
 
Thanks...figures that it was that simple. Is there anywhere I can find a list of HTML tags that flash will recognize?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top