/ Published in: ActionScript 3
This doesn't show you how to load an external style sheet but it simulates what would happen if the stylesheet.css had already been loaded. Note! There is no simple way of applying a stylesheet to a TextArea component in Flash CS3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var style:StyleSheet = new StyleSheet(); style.parseCSS("h4{color:#ff0000; fontWeight:bold; fontSize:30;}a:link{text-decoration: none;}a:hover{text-decoration: underline;}"); var ti:TextField = new TextField(); ti.x = 150; ti.y = 150; ti.width = 100; ti.height = 100; ti.styleSheet = style; ti.htmlText = "<h4>library</h4>"; ti.htmlText += "<p><a href=\"event:http://www.usc.edu\" target=\"_blank\">science</a></p>"; addChild(ti);