I have two MC’s news1 & news2.
Each of them has an identical xml constructor and css constructor. The first one loads ok, but the second one does not.
Here is my code for news1
//load css
var myCSS = new TextField.StyleSheet();
var cssURL = "stylesheet.css";
myCSS.load(cssURL);
myCSS.onLoad = function(success) {
if (success) {
myTitle.styleSheet = myCSS;
myContent.styleSheet = myCSS;
}
};
//add xml content
newsContent = new XML();
newsContent.ignoreWhite = true;
newsContent.load("news.xml");
newsContent.onLoad = function(success)
{
if(success)
{
myTitle.text = newsContent.firstChild.firstChild.firstChild;
myContent.text = newsContent.firstChild.firstChild.firstChild.nextSibling;
}
}
news2
//load css
var myCSS = new TextField.StyleSheet();
var cssURL = "stylesheet.css";
myCSS.load(cssURL);
myCSS.onLoad = function(success) {
if (success) {
myTitle.styleSheet = myCSS;
myContent.styleSheet = myCSS;
}
};
//add xml content
newsContent = new XML();
newsContent.ignoreWhite = true;
newsContent.load("news.xml");
newsContent.onLoad = function(success)
{
if(success)
{
myTitle.text = newsContent.firstChild.firstChild.nextSibling.firstChild.firstChild;
myContent.text = newsContent.firstChild.firstChild.nextSibling.firstChild.nextSibling.firstChild;
}
}
My XML file
<newsContent>
<newsA>
<newsAtitle>New Web Site Launched</newsAtitle>
<newsAstory>A new website has been launched to showcase Nick Toye's work. It is modelled on various influences from the New Beetle, to Royksopp music. A smooth transition was one of the main aims, along with an ease of use.
I wanted to provide information without it getting lost in the navigation, I feel that I have achieved this simplicity.
I have found that in many of my designs, white space generates a calming atmosphere and allows the content to flow with more impact.</newsAstory>
</newsA>
<newsB>
<newsBtitle>Some more news</newsBtitle>
<newsBstory>Some more news will go here</newsBstory>
</newsB>
</newsContent>
and my CSS stylesheet
newsAtitle {
color: #990000;
font-size:10px;
}
newsAstory {
color:#006699;
font-size:10px;
}
newsBtitle {
color: #990000;
font-size:10px;
}
newsBstory {
color:#006699;
font-size:10px;
}
If anyone can see why the stylesheet isn’t loading for the second MC I will be most grateful.
Many thanks in advance