This shows how to create Cascading Style Sheets using ActionScript.
/**************************
CSS Translation of Properties
**************************/
/*
HTML ActionScript
color color
display display
font-family fontFamily
font-size fontSize
font-weight fontWeight
margin-left marginLeft
margin-right marginRight
text-align textAlign
text-decoration textDecoration
*/
//A. Create a new Style Sheet
var ss = new TextField.StyleSheet();
ss.setStyle(".headline", {color:"#FFCCCC", fontSize:"18px"});
ss.setStyle("p", {color:"#666666", fontSize:"14px"});
//B. Create Some Strings
var headline:String = "<span class='headline'>Header 1</span><br>";
var p:String = "<p>lorem ipsum.....</p>";
//C. Create a Dynamic Text Field
var text_txt:TextField = this.createTextField("text_txt", this.getNextHighestDepth(), 0, 0, 100, 50);
text_txt.multiline = true;
text_txt.wordWrap = true;
text_txt.styleSheet = ss;
//D. Load
text_txt.htmlText = headline + p;
/**************************
Undocumente but Useful
**************************/
//Code to Transfer CSS styles to TextFormat
var textStyle:Object = ss.getStyle(".headline");
var tf:TextFormat = ss.transform(textStyle);
AS3: Regular Expression Basics
Here are some Regular Expression basics in Actionscript 3. 1. RegExp.text(string) returns a Boolean 2. RegExp.exec(string) returns an Object 3. String.search(pattern) returns...
AS3: Use HTML and JavaScript to send Text to Flash
This is the first of two ways to send Text to Flash using HTML and JavaScript. To follow my example, you must download and link to [SWFObject](http:...
AS3: Regular Expression Basic example
The first example strips out the HTML. The second example shows how to target a single quote using unicode. //////////////////////////////////////////// //Example 1: //////////////////////////////////////////// var re:RegExp = /<font face=\u0022(...
Subscribe to new posts
Processing your application
Please check your inbox and click the link to confirm your subscription
There was an error sending the email