Return to Snippet

Revision: 4224
at November 8, 2007 16:46 by chrisaiv

Initial Code
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:\" target=\"_blank\">science</a></p>";

Initial URL

Initial Description
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

Initial Title
AS3: Adding styles to a TextField() using a new StyleSheet() object

Initial Tags

Initial Language
ActionScript 3