Hi all,
I am hopeful someone can recommend a solution to my dilemma. Here is what I have...
I am building a simple Flash tutorial with an XML file, two movie clips that act as "Next" & "Previous" buttons and a textbox placeholder for content from the XML file. I am using <![CDATA[...]]> in the XML so I can format the content with HTML tags.
My XML looks something like this...
<lesson>
<screen audio="scriptclip1.mp3" artwork="image1.jpg">
<![CDATA[<b>Lesson 1</b> text goes here]]>
</screen>
<screen audio="scriptclip2.mp3" artwork="image2.jpg">
<![CDATA[Lesson 2 text goes here]]>
</screen>
<screen audio="scriptclip3.mp3" artwork="movie.swf">
<![CDATA[Lesson 3 text goes here]]>
</screen>
</lesson>
The functionality of the tutorial works just fine, however, the text formatting is rendering the HTML tags. I am stumped about how to code this properly and it is highly possible I am missing something simple. I have also spent quite abit of time in this forum and others reading what I could about the use of XML and CDATA, but couldn't quite get my actionscript to work.
Here is what the script looks like:
drawScreen = function(){
info_txt.text = lessonList[currentScreen];
info_txt.background = true;
info_txt.border = true;
info_txt.borderColor = 0xC0C0C0;
if (currentScreen == 0){
prev_mc._visible = false;
}else{
prev_mc._visible = true;
}
if (currentScreen == lessonList.length-1){
next_mc._visible = false;
}else{
next_mc._visible = true;
}
}
next_mc.onRelease = function(){
stopAllSounds();
++currentScreen;
drawScreen();
}
prev_mc.onRelease = function(){
stopAllSounds();
--currentScreen;
drawScreen();
}
currentScreen = 0;
lessonList = new Array();
lesson_xml = new XML();
lesson_xml.ignoreWhite = true;
lesson_xml.onLoad = function(){
var screenNode = this.firstChild.firstChild;
var audioClip = this.firstChild.firstChild.attributes.audio;
while (screenNode != null){
lessonList.push(screenNode.firstChild.nodeValue);
screenNode = screenNode.nextSibling;
soundHolder = new Sound();
soundHolder.loadSound(audioClip);
soundHolder.start(0);
}
drawScreen();
}
lesson_xml.load("lesson.xml"
Any ideas anyone?
Thanks,
websh
I am hopeful someone can recommend a solution to my dilemma. Here is what I have...
I am building a simple Flash tutorial with an XML file, two movie clips that act as "Next" & "Previous" buttons and a textbox placeholder for content from the XML file. I am using <![CDATA[...]]> in the XML so I can format the content with HTML tags.
My XML looks something like this...
<lesson>
<screen audio="scriptclip1.mp3" artwork="image1.jpg">
<![CDATA[<b>Lesson 1</b> text goes here]]>
</screen>
<screen audio="scriptclip2.mp3" artwork="image2.jpg">
<![CDATA[Lesson 2 text goes here]]>
</screen>
<screen audio="scriptclip3.mp3" artwork="movie.swf">
<![CDATA[Lesson 3 text goes here]]>
</screen>
</lesson>
The functionality of the tutorial works just fine, however, the text formatting is rendering the HTML tags. I am stumped about how to code this properly and it is highly possible I am missing something simple. I have also spent quite abit of time in this forum and others reading what I could about the use of XML and CDATA, but couldn't quite get my actionscript to work.
Here is what the script looks like:
drawScreen = function(){
info_txt.text = lessonList[currentScreen];
info_txt.background = true;
info_txt.border = true;
info_txt.borderColor = 0xC0C0C0;
if (currentScreen == 0){
prev_mc._visible = false;
}else{
prev_mc._visible = true;
}
if (currentScreen == lessonList.length-1){
next_mc._visible = false;
}else{
next_mc._visible = true;
}
}
next_mc.onRelease = function(){
stopAllSounds();
++currentScreen;
drawScreen();
}
prev_mc.onRelease = function(){
stopAllSounds();
--currentScreen;
drawScreen();
}
currentScreen = 0;
lessonList = new Array();
lesson_xml = new XML();
lesson_xml.ignoreWhite = true;
lesson_xml.onLoad = function(){
var screenNode = this.firstChild.firstChild;
var audioClip = this.firstChild.firstChild.attributes.audio;
while (screenNode != null){
lessonList.push(screenNode.firstChild.nodeValue);
screenNode = screenNode.nextSibling;
soundHolder = new Sound();
soundHolder.loadSound(audioClip);
soundHolder.start(0);
}
drawScreen();
}
lesson_xml.load("lesson.xml"
Any ideas anyone?
Thanks,
websh