Using HTML Text in Tooltip AS 3.0 Component
Updated: Aug 30, 2007
Views: 1599
Description: This tutorial will show you how to display HTML and plain text with the Tooltip ActionScript 3.0 component.
To get started, here is an example of what we are going to build.
| |
Part II - Setting Up the File and Adding Tooltip to a Button
The first step is to create a document, add a button and an instance of the Tooltip component. Also you would need to add the Tooltip to the rollover states of the button. If you need help doing this, please follow either the AddOwner Tutorial or Show/Hide Tutorial.
Part III - Setting Parameters of Tooltip for HTML text
Select the instance of the Tooltip on stage, and using the component inspector (Window > Component Inspector) or parameters panel (Window > Properties >{Parameters) set the following parameters of the instance of the Tooltip:
- type: text
- In contentstyle -> textHTML: true
Part IV - Setting Content
This is again done in the component inspector or parameters, set the content field to
"This is <b>AWESOME</b><br><br>yes it is!!!"
or what string you would like. This can also be done in ActionScript with the following codemyTooltip.content= "This is <b>AWESOME</b><br><br>yes it is!!!"
Part V - Formating the text
The text can also be formatted through component inspector and the parameters by editing the contentStyle field and changing the values of:
- textColor
- textFont
- textAlign
- textSize
This can also be done through ActionScript:
myTooltip.contentStyle = {textColor: 0xFF0000, textFont: "arial", textEmbed: false, textSize: 12, textHTML: true, textAlign: "left", horizontalPadding: 5, verticalPadding: 5};
If you have any questions please post them on our forum.
Other Tutorials
