3d carousel tutorial question
by sbparke
on
Sep 18, 2007 at 7:12:42 pm
I had a question for anyone familiar with Lee Brimlow's flash tutorial on 3d carousels(gotoandlearn.com). I'm trying to figure out a way to format the dynamic text that is read in from the xml document. For example making a bold header or a different color and font size, or inserting paragraph breaks.
Re: 3d carousel tutorial question by Sher Ali on Sep 18, 2007 at 10:48:12 pm
You can use only those html tags which are supported by flash. You also set the dynamic text field's text first setting its html property to true and then assign the text using its htmlText property.
You can use external css file to define rules for html tags. Following is a sample code, which I use in almost all of my projects.
import TextField.StyleSheet;
var flash_css:StyleSheet = new StyleSheet();
flash_css.onLoad = function(success:Boolean) {
if (success) {
//When the style css file is loaded succefully then do nothing
//as it will be used later when required
//trace("Styles loaded:");
} else {
//in case of error show a trace message
trace("Error loading CSS");
}
};
//load css file
flash_css.load("flash_css.css");
once the stylesheet is loaded and suppose you have a text field myDescriptionText which has some text along with html tags then apply the newly loaded stylesheet as:
myDescriptionText.html = true;
myDescriptionText.htmlText = "This is a bold text";
myDescriptionText.styleSheet = flash_css;