EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Page 1147

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
StyleSheet (TextField.StyleSheet) 1147
trace("This is an empty style sheet.");
} else {
for (var i = 0; i<styleNames.length; i++) {
var styleName:String = styleNames[i];
trace("Style "+styleName+":");
var styleObject:Object = my_styleSheet.getStyle(styleName);
for (var propName in styleObject) {
var propValue = styleObject[propName];
trace("\t"+propName+": "+propValue);
}
trace("");
}
}
}
}
Create a CSS document called styles.css, which has two styles called .heading and
.mainBody that define properties for font-family, font-size and font-weight. Enter the
following code in the CSS document:
/~ In styles.css ~/
.heading {
font-family: Arial, Helvetica, sans-serif;
font-size: 24px;
font-weight: bold;
}
.mainBody {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}
Finally, in a FLA or ActionScript file, enter the following ActionScript to load the external
style sheet, styles.css:
StyleSheetTracer.displayFromURL("styles.css");
This displays the following in the Output panel:
Style .heading:
fontWeight: bold
fontSize: 24px
fontFamily: Arial, Helvetica, sans-serif
Style .mainBody:
fontWeight: normal
fontSize: 12px
fontFamily: Arial, Helvetica, sans-serif
See also

Table of Contents

Related product manuals