Dynamic text with links

Hi,

I have a dynamic text field where I import the text from a php file. It is html-enabled and some words are links in that text to other parts of the Flash file.

The text can be something like this:


$alotoftext = "asd asd sad asd as ds da sds d <a href=\"asfunction, link, 1\">This is a link</a> and some more text";

Is it possible to do a “hover/over” function for that link? Maybe change the color of the text or something else?

If you are targeting the Flash Player version 7, then you can do this using the new CSS features in it. You need to have css with a:hover and a:link styles defined. You can either do this in code or use stylesheet.load to load an external css file instead.


	createTextField ("txt", 1, 0, 0, 300, 300);
	txt.html = true;
	txt.multiline = true;
	txt.wordWrap = true;
	txt.border = true;
	
	css = new TextField.StyleSheet ();
	css.setStyle ("a:link", {color:"#0000FF"});
	css.setStyle ("a:hover", {color:"#FF0000"});
	
	txt.htmlText = "<a href='asfunction:trace,link1'>Link 1</a><br><a href='asfunction:trace,link2'>Link 2</a>";
	txt.styleSheet = css;