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
Solved

How do I bold text dynamically in AS3

Posted on 2011-02-23
7
609 Views
Last Modified: 2013-11-11
Question 1:
I would like to call data from a mysql database using php to the variable "var cookbookText:String".
Below I manually entered the text from the database. How is this done?

Question 2:
I would also like to dynamically bold and underline specific text after called from the database.
For example, I would like to bold/underline the word "Doritos". How is this done?

var cookbookText:String = "3 chicken breasts, boiled, cubed, reserve broth" + "<br>" +
"1 med. onion, chopped" + "<br>" +
"1/2 stick butter" + "<br>" +
"1 can cream of mushroom soup" + "<br>" +
"1 can cram of chicken soup" + "<br>" +
"1 1/2 tbsp. chili powder" + "<br>" +
"1 (16 oz.) bag Nacho cheese Doritos, crushed" + "<br>" +
"8 oz. Cheddar cheese, grated" + "<br>" +

Output to textfield is as follows:
                     LabelRecipetxt.border = true
      LabelRecipetxt.multiline = true
      LabelRecipetxt.wordWrap = true
      LabelRecipetxt.htmlText ='<font size = "12">' + cookbookText +'</font>';

Thanks in advance
0
Comment
Question by:eager_to_learn
  • 5
  • 2
7 Comments
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 34961327
Use a dynamic textbox and set it to "Render as HTML" and you should be good to go to use the html codes "<b>" and "<i>"
http://www.smartwebby.com/Flash/html_textbox.asp
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 34961350
Here comes some info on the underlining (It's done differently):
http://www.permadi.com/tutorial/flashTextUnderline/index.html
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 34961363
To your first question: What type of sever are you using? Java, PHP, ASP? Depending on the server-side technology the answer will be different.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:eager_to_learn
ID: 34961489
The server side technology is PHP.
0
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 500 total points
ID: 34961584
0
 

Author Comment

by:eager_to_learn
ID: 34961588
ChristoferDutz: Thanks for the quick response

The articles are helpful with understanding the behaviors of html in a dynamic textbox. But my start point is a little hazy...

How would I bold a specific word from a database to a textfield without having to manually input <b> or <i>?
0
 
LVL 20

Assisted Solution

by:ChristoferDutz
ChristoferDutz earned 500 total points
ID: 34961614
Ok ... well in this case, I'd use a regualr expression to replace the string "word" with "<b>word</b>"
http://www.actionscript.org/forums/showthread.php3?t=160065
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

839 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