/ Published in: ActionScript 3
There's a way to add styles to text without using the traditional StyleSheet() object. I tend to think of this as a quick and dirty solution
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Create an style that would simulate <h4> tags var h4:Object = new Object(); h4.fontWeight = "bold"; h4.color = "#FF0000"; h4.fontSize = 30; //Create a Style to simulate a:link tags var a:Object = new Object(); a.color = "#00FF00"; a.fontSize = 25; var aHover:Object = new Object(); aHover.fontSize = 25; aHover.color = "#cccccc"; var style:StyleSheet = new StyleSheet(); style.setStyle("h4", h4); style.setStyle("a", a); style.setStyle("a:hover", aHover); var tf:TextField = new TextField(); tf.x = 150; tf.y = 150; tf.width = 100; tf.height = 100; tf.styleSheet = style; tf.htmlText = "<h4>library</h4>"; tf.htmlText += "<p><a href=\"event:http://www.usc.edu\" target=\"_blank\">science</a></p>"; addChild(tf);