Click to See Complete Forum and Search --> : Cascading Style Sheets
dniezby
11-25-2006, 05:52 PM
Anyone had any success with Style Sheets to display Content Pane HTML content?
w.brants
11-26-2006, 02:08 AM
What are you trying to accomplish ?
Flash CSS support is pretty limited.
dniezby
11-26-2006, 02:23 PM
I've been looking to use style sheets to format text for a news page.
I was trying to use this script:
//Load CSS Sheet
var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.onLoad = function(success:Boolean):Void {
if (success) {
// display style names.
trace(this.getStyleNames());
} else {
trace("Error loading CSS file.");
}
};
styles.load("styles.css");
It doesn't work though.
MY SOURCE OF THIS INFO (http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00001014.html)
w.brants
11-26-2006, 02:56 PM
The code you posted is AS 2 syntax. You have to convert it to AS 1 in order to use it.
Here's an AS 1 example that uses the stylesheet class.
Create a dynamic textfield with 'has html' set to yes.
var css_str = '.heading {font-size: 24px; font-weight: bold; }';
var my_styleSheet = new TextField.StyleSheet();
my_styleSheet.parseCSS(css_str);
txt1.styleSheet = my_styleSheet;
txt1.htmlText = "<p class='heading'>My formatted text</p>";
Wilbert
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.