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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a dynamic text field be bold and regular? 2

Status
Not open for further replies.

danielh68

Technical User
Jul 31, 2001
431
US
Hi,

I just created a scrollable area with a dynamic text field. It's actually a restaurant menu. Anyhow, I would like to bold the main categories such as: BURGERS, BEVERAGES, etc. However, when I do and preview it, the whole text field is bold. It's either all bold or not. Is there a remedy to this?

Thanks in advance,
Dan
 
You need to set the textfield as HTML then use a string like this to populate it:

Code:
myText='<b>stuff in bold<?b> stuff in regular';

You also have to have the regular and bold outlines of the font embedded somewhere in your movie for them both to display (I usually include a layer specifically for this with a bunch of textfields in it with their setting set to embed the font).
 
Use a text file for your menu text and load it into the textarea. Allow HTML in the text area and just use the <b></b> on your menu items.

Create a text file in the same directory as your flash movie. Name it myMenu.txt. Here is a sample:

Code:
myMenu=<b>Burgers</b><br>Super Mac Daddy<br>Really big Mac Daddy
<b>Fries</b><br>Cheese Fries<br>Curly Fries

In the flash movie the text area has the instance name "myMenu". Set the text area html property to true (component inspector or the parameters tab of the Properties panel, or by AS).

Then add the following to an actions layer in the timeline that contains the myMenu text area.

Code:
myVars = new LoadVars();
myVars.onLoad = function(success){
	if (success){
		myMenu.text = myVars.myMenu;
	}else{
		myMenu.text = "error";
	}
}
myVars.load("myMenu.txt");

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Thanks guys for your help...much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top