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

Text Formatting

Status
Not open for further replies.

MikeCB

Technical User
Aug 12, 2004
43
GB
Hi Everyone,

Hope someone can help me. I am using Flash CS4 Professional and I have an input text box. I need to be able to type something into this box when viewing the flash and highlight certain bits of text and then make it bold and underlined etc. Is there anyway to do this?

I no how to make a full text box bold and underlined when clicking on a button but I only want to do this for the text that I highlight.

Please help.

Thanks
 
Hya kennethkawamoto,

Thanks for the reply. How would you write this in the action script?

Cheers
 
An example button click function. [tt]_tf[/tt] is the input TextField.
Code:
private function boldButtonClick(e:MouseEvent):void {
   var tfmt:TextFormat = new TextFormat();
   tfmt.bold = true;
   _tf.setTextFormat(tfmt, _tf.selectionBeginIndex, _tf.selectionEndIndex);
}

Kenneth Kawamoto
 
Hya,

I'm getting an error with this code.

Error: Attribute used outside class
 
Im using AS2. I haven't started using AS3 yet
 
Hya kennethkawamoto,

Sorry for the delay I haven't had chance to try this yet. I will be looking at it again tomorrow and I will let you know.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top