Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

52 users online



CSS in Flash through XML; roadblock :(

CSS in Flash through XML; roadblock :(

Currently viewing this thread: 1 (0 members and 1 guests)


knappster

knappster

Flash designer, learner.
Status: Offline!

CSS in Flash through XML; roadblock :(

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";
}
}
};


Here is the XML:

Code:

<?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>


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;
}

I attached the files I used for this.

Thanks in advance for any help Smile

Attachments:

xmlcsshtml.zip 127.02 Kb, 73 views

james182

james182

Neverside Newbie
Status: Offline!

try this site this is where i learnt:
http://www.nwebb.co.uk/nw_htmlsite/index.php?page=brows ... lhtmlcss1&part=1

knappster

knappster

Flash designer, learner.
Status: Offline!

Thanks, that's where I learned too, but now I'm stuck on this problem they don't teach there.

james182

james182

Neverside Newbie
Status: Offline!

try this:

Attachments:

xmlhtmlcss.fla 491.5 Kb, 75 views

knappster

knappster

Flash designer, learner.
Status: Offline!

Thanks James... I've tried that and it works fine, however, what I'm trying to do is format the layout of the text. For example, I'd like the <entrytitle> to be on the same line as <entrydate>, with the <entrybody> right below it, and I'd like each entry seperated by a "---" or something. Could this be formatted from flash?

Any ideas?

knappster

knappster

Flash designer, learner.
Status: Offline!

Ok, I got that working ... but the CSS still doesn't work when I use the for loop.

Any ideas on that?

devonair

devonair

Neverside Newbie
Status: Offline!

hey knappster,

your for loop was drilling down to deep. It went right down to the exact node values, but for the css to work, your text field has to include the tags, not just the what's between the tags.. There were a few other problems to, but that was the biggie..

Dig this:

Attachments:

cssEx.zip 7.44 Kb, 62 views

___________________

obod | weapons of mass dysfunction

knappster

knappster

Flash designer, learner.
Status: Offline!

Thanks so much devonair, you've solved it Smile

aok

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0085 seconds.