Return to Snippet

Revision: 80616
at March 23, 2020 05:18 by chrisaiv


Updated URL
https://www.chrisjmendez.com/2008/01/30/as2-inline-css/

Updated Code
https://www.chrisjmendez.com/2008/01/30/as2-inline-css/

Updated Description
https://www.chrisjmendez.com/2008/01/30/as2-inline-css/

Revision: 80615
at March 23, 2020 05:16 by chrisaiv


Updated URL
https://www.chrisjmendez.com/2008/01/30/create-cdata-tags-between-xml-nodes-using-as/

Updated Code
https://www.chrisjmendez.com/2008/01/30/create-cdata-tags-between-xml-nodes-using-as/

Updated Description
https://www.chrisjmendez.com/2008/01/30/create-cdata-tags-between-xml-nodes-using-as/

Revision: 4936
at January 30, 2008 00:16 by chrisaiv


Initial Code
/**************************
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);

Initial URL

                                

Initial Description
This shows how to create Cascading Style Sheets using ActionScript

Initial Title
AS2: Inline CSS

Initial Tags
css

Initial Language
ActionScript