|
|
|
#1 |
|
Member
Join Date: Jun 2003
Posts: 31
|
CSS in Flash via XML ... close!
Hi there,
I've managed to learn alot of steps to getting to where I've gotten, but I can't seem to get it, and I'm at a dead end. What I'm trying to do is display CSS enhanced text in flash with an XML file. The problem is that when the text is in the given text box, it's not formatted, and only the 2nd entry is posted, even though tracing it displays the text perfectly. Here is the flash: Code:
newsText.html = true;
newsText.wordWrap = true;
newsText.multiline = true;
newsText.label.condenseWhite=true;
newsStyle = new TextField.StyleSheet();
newsStyle.load("styles.css");
newsText.styleSheet = newsStyle;
newsContent = new XML();
newsContent.ignoreWhite = true;
newsContent.load("conglomeration.xml");
newsContent.onLoad = function(success)
{
if (success) {
var news = newsContent.firstChild.firstChild;
var newsEntries = news.childNodes;
for (var e=0; e<newsEntries.length; e++){
currEntry = newsEntries[e];
newsText.text = currEntry.firstChild.firstChild.nodeValue +" > "+ currEntry.firstChild.nextSibling.firstChild.nodeValue +"\n"+ currEntry.firstChild.nextSibling.nextSibling.firstChild.nodeValue +"\n"
}
}
}
[HTML]<?xml version="1.0" encoding="UTF-8" ?> <conglomeration> <news> <entry> <entrydate>Jul.18.05</entrydate> <entrytitle>First Entry</entrytitle> <entrybody> <![CDATA[First news entry will go here.]]> </entrybody> </entry> <entry> <entrydate>Jul.19.05</entrydate> <entrytitle>Second Entry</entrytitle> <entrybody> <![CDATA[Second news entry will go here.]]> </entrybody> </entry> </news> </conglomeration>[/HTML] and here is the CSS: Code:
entrydate {
color: #FF0000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
display: block;
}
entrytitle {
color: #0000FF;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
display: block;
}
entrybody {
color: #000000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
display: block;
}
Thanks in advance for any help
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Aug 2002
Location: Dublin, Ireland
Posts: 1,746
|
1. You need to use htmlText to show the html...
2. Which means you need to include tags... 3. Which means you don't need to walk the tree to show your list...
|
|
|
|
|
|
#3 |
|
Member
Join Date: Jun 2003
Posts: 31
|
Thanks, that's a little closer ... the CSS works at least. I would like to be able to format the text, however. For example, I would like the <entrydate> and <entrytitle> to be on the same line, and each <entry> to be seperated by something like "______" and another break.
Any ideas? |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Aug 2002
Location: Dublin, Ireland
Posts: 1,746
|
You can use the "display" attribute in CSS to control whether tags should display "inline" or in a separate "block".
If you want to start playing with the layout more, it is best to separate the elements, for example:
|
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|