Hi,
I’m creating a new website, and it has to be fairly dynamic. So, I load everything through one XML document. Now, depending on the content of a certain child in each menu, it loads a new page. There are going to be about 10 pages, to choose between.
So, I start coding, and all the content works fine, but my html tags won’t work. I’ve activated the “render as html” button, in the textField parameter (the instance name is: “nyhedText”). I’ve also written, nyhedText.html = true; and nyhedText.htmlText = theContent - not the exact same names, but it is the same code.
My entire code for the page is:
[AS]// defines the variable model1_spacing
var model1_spacing = 0;
// defines the variable model1_count
var model1_count = 0;
// the function that creates the whole thing, after the XML is loaded
function createModel1(menu1_xml) {
// starts with the first item in the XML
var model1_item = menu1_xml.firstChild.firstChild.childNodes[goldenNumber].childNodes[2].childNodes;
// selected menu -> array
for (var q = 0; q<model1_item.length; q++) {
// finds the header
var nyhedHeader = model1_item[q].childNodes[0];
// finds the text
var nyhedText = model1_item[q].childNodes[1];
// finds the link
var nyhedLink = model1_item[q].childNodes[2];
// creates the elements in the array
var model1_mc = root.container.attachMovie(“model1_item”, "model1"+model1_count, model1_count);
// placing the elements
model1_mc._y = model1_spacing;
// model1_number
model1_mc.modelNumber = q;
// adds to the count
model1_count++;
// textField link
model1_mc.nyhedLink.html = true;
model1_mc.nyhedLink.htmlText = nyhedLink
// textField header
model1_mc.nyhedHeader.autoSize = true;
model1_mc.nyhedHeader.htmlText = nyhedHeader;
// textField text
model1_mc.nyhedText.autoSize = true;
model1_mc.nyhedText._y = model1_mc.nyhedHeader._y+model1_mc.nyhedHeader._height;
model1_mc.nyhedText.html = true;
model1_mc.nyhedText.htmlText = nyhedText;
// model1_spacing
model1_spacing += model1_mc._height+20;
// number
model1_mc.number.text = q+1;
}
}
// manage XML
// create new XML object instance, remembering to ignore white space
var content_xml = new XML();
content_xml.ignoreWhite = true;
// define an onLoad to create our location menu when the XML has successfully loaded.
content_xml.onLoad = function(success) {
if (success) {
createModel1(this);
} else {
trace(“Error loading XML file”);
}
// no success? trace error (wont be seen on web)
};
// load the xml file!
content_xml.load(“indhold.xml”);[/AS]Any hints or help, would be much appreciated.