i guess the formatting assumptions are a bit of a misconception on my part. thanks for clearing this up.
i'll show you an example of what I am trying to do.
First i have a basic HTML file (faq.html):
Code:
<html>
<head><title>Frequently Asked Questions</title></head>
<body>
<h1>This is the first question?</h1>
<p>This is the first answer.</p>
<h1>This is the second question?</h1>
<p>This is the second answer.</p>
<h1>This is the third question?</h1>
<p>This is the third answer.</p>
</body>
</html>
I want it to appear inside a TextArea component instance with formatting (a whole diff beast but maybe you can help me with this too). So i have the following AS on frame 1 of a movieclip with an instance of the component on the stage that has an instance name "textarea"
Code:
//var textarea:mx.controls.TextArea;
textarea.depthChild0._alpha = 0;
// Create the new StyleSheet object.
var my_styles:TextField.StyleSheet = new TextField.StyleSheet();
my_styles.setStyle("h1", {fontFamily:"Arial,Helvetica,sans-serif", color:"#FF0000", fontWeight:"bold"});
my_styles.setStyle("p", {fontFamily:"Arial,Helvetica,sans-serif", color:"#000000"});
// Set the TextAreaInstance.styleSheet property to the newly defined
// styleSheet object named styles.
textarea.styleSheet = my_styles;
textarea.html = true;
// Load text to display and define onLoad handler.
var my_lv:LoadVars = new LoadVars();
my_lv.onData = function(src:String) {
if (src != undefined) {
textarea.text = src;
} else {
textarea.text = "Error loading HTML document.";
}
};
my_lv.load("faq.html");
i think this should produce what i want, but i end up with something that looks like this:
Code:
Frequently Asked QuestionsThis is the first question?This is the first answer.
This is the second question?This is the second answer.
This is the third question?This is the third answer.
for reference, i want it to look like this:
This is the first question?
This is the first answer.
This is the second question?
This is the second answer.
This is the third question?
This is the third answer.
(notice that I dont want the title to appear, i want line breaks between the lines of text, and i want color and font-weight styling)
Bookmarks