Hey guys,
I am tasked with trying to do a slideshow of sorts, and I need to pull the filename of the slide from an xml file and display it, as well as display the appropriate slide notes in a text box.
the xml file they gave me is formatted as below, and with my current code (also below) I’m able to (trace) list all the file names, but I am missing how to address the filename on just one slide – say, slide 1, so I can then load it into a loader.
Any idea what I’m missing to get the attributes out of this based on the slide id number or whatever?
any help would be appreciated, thanks!
=======
here’s my code
import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;
var imagesXML:XML;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(new URLRequest("assets/xml/slides_show.xml"));
function xmlLoaded(evt:Event):void
{
imagesXML = new XML(xmlLoader.data);
trace(imagesXML.slide.filename);
}
===
here’s an XML sample they sent
<?xml version="1.0" encoding="utf-8"?>
<slides>
<slide id="1">
<filename>slide_showa_002.gif</filename>
<order>1</order>
<speakernotes>blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah</speakernotes>
<question>-Part4</question>
</slide>
<slide id="2">
<filename>slide_showa_003.gif</filename>
<order>2</order>
<speakernotes>blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
</speakernotes>
<question>Part5</question>
</slide>
<slide id="3">
<filename>slide_showa_004.gif</filename>
<order>3</order>
<speakernotes>blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
</speakernotes>
<question>Part6</question>
</slide>
<!-- XXXXXXXXXXXXXXXXXXXX END TAG BELOW XXXXXXXXXXXXXXXXXXXXXXXXXXXX-->
</slides>