# CSS Error or Flash Version Problem

**URL:** <https://forum.kirupa.com/t/css-error-or-flash-version-problem/199764>\
**Category:** flash\
**Created:** [September 5, 2006, 7:56pm UTC](https://forum.kirupa.com/t/css-error-or-flash-version-problem/199764 "2006-09-05T19:56:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![garebear](https://avatars.discourse-cdn.com/v4/letter/g/b782af/32.png) [@garebear](https://forum.kirupa.com/u/garebear)\
**Post date:** [September 5, 2006, 7:56pm UTC](https://forum.kirupa.com/t/css-error-or-flash-version-problem/199764/1 "2006-09-05T19:56:42Z")

</div>

I have been publishing for Flash 8 but for reasons out of my control, I have to publish to version 7 now. The CSS that I have been using successfully for 8 is now working incorrectly. **The problem that occurs is that the first answer text field is not formatted using the CSS but all the following answer fields are.**

I have a question and up to 6 answers in a test. The text in all the fields are being formatted with CSS. For the answers, it is in a loop as all the text information is being pulled in through XML.

Here is the relevant code [COLOR=blue]**(Pay special note to code in Blue):**[/COLOR]

//------------------------------------------------------------\<initialize XML  
var myXML:XML = new XML();  
myXML.ignoreWhite = true;

//-----------------------------------------------------------------------\<CSS  
**[COLOR=blue]var styles:TextField.StyleSheet = new TextField.StyleSheet();  
styles.onLoad = function(success:Boolean):Void {  
if (success) {  
// display style names.  
// trace(this.getStyleNames());  
} else {  
trace(“Error loading CSS file.”);  
}  
};  
styles.load("…/…/…/…/…/css/tests.css");[/COLOR]**

//-----------------------------------------------------------------------\<XML  
test = myXML.firstChild; //\<test001001\> XML  
question = test.childNodes; //\<question\> XML  
answer = test.firstChild.childNodes; //\<answer\> XML

var TESTNAMETXT = test.attributes.testName;  
testNameTxt.styleSheet = styles;  
testNameTxt.text = “\<p class=‘testName’\>” + TESTNAMETXT + “\</p\>”; //CME Title Name XML

loadTxt = function() {  
if (i == 0) { // First Question Navigation Buttons Visibility  
prevBtn.\_visible = false;  
} else {  
prevBtn.\_visible = true;  
}  
if (i == (question.length - 1)) { // Last Question Navigation Buttons Visibility  
nextBtn.\_visible = false;  
if ((radioBtn0.selected == true) || (radioBtn1.selected == true) || (radioBtn2.selected == true) || (radioBtn3.selected == true) ||(radioBtn4.selected == true) || (radioBtn5.selected == true) || (radioBtn05.selected == true)) {  
submitBtn.\_visible = true;  
}  
} else {  
nextBtn.\_visible = true;  
submitBtn.\_visible = false;  
}

var QUESTION = question\*.attributes.name;  
questionTxt.styleSheet = styles;  
questionTxt.text = “\<p class=‘question’\>” + QUESTION + “\</p\>”; //Load Question Text from XML  
this[“correct” + i] = question\*.attributes.correct; //Store Correct Answer into corresponding Variable

[COLOR=blue]_for (var j=0; j\<answer.length; j++) { //Loads Available Answers into Corresponding Text Fields  
var answerTF:TextField = this[“answerTxt” + j];  
answerTF.styleSheet = styles;  
var ANSWER = test.childNodes.childNodes[j].attributes.name;  
answerTF.text = “\<p class=‘answer’\>” + ANSWER + “\</p\>”;  
}_\*[/COLOR]

for (var k=0; k\<6; k++) { //Radio Button Visibility  
var answerRadioButton = this[“radioBtn” + k];  
if(test.childNodes\*.childNodes[k].attributes.name == “”) {  
answerRadioButton.\_visible = false;  
} else {  
answerRadioButton.\_visible = true;  
}  
}  
}  
loadTxt();  
} else {  
questionTxt.text = “Error”;  
}  
}  
myXML.load("…/…/category/categor001/lecture001/test001001/xml/test001001.xml"); // SERVER XML LOCATION  
[//myXML.load](https://myXML.load)("…/xml/test001001.xml"); // LOCAL XML LOCATION

* * *

Any thoughts on why this works in 8 but not in 7 and how to fix it so that it will work?  
Thanks!
