Hey All, Another AS novice here. I have a FLA built that pulls in external .swf files via XML files. On a button click inside the FLA I load the SWF into a small window in the FLA. I can get it to play, stop and pause… but the sound still plays because it’s embedded in the SWF file. Sooo, I wanted to try to load the MP3 files along with loading the SWF files. But I can’t seem to get it working. I’m sure there’s some big mistake with pulling the sound file in and getting it to play - I just don’t know enough about AS to see them. Any help would be GRRRREATLY appreciated! Thx!
Here is the code that’s pulling in the files:
//Create the XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Load XML file
myXML.load("seminars.xml?cachebuster=" + new Date().getTime());
//Make a reference to current timeline
myXML.ref = this
// Parse XML and fetch
myXML.onLoad = function(success){
if(success){
var root = this.firstChild
nodes = root.childNodes
for(var i=0; i<nodes.length; i++) {
this.ref["Title_txt"+i].text = nodes*.attributes.name
subnodes = nodes*.childNodes
this.ref["Comments_txt"+i].text = subnodes[0].firstChild.toString()
this.ref["Link_txt"+i].text = subnodes[0].firstChild.toString()
this.ref["Link_txt"+i] = subnodes[1].firstChild.toString()
this.ref["holder_mc"+i].loadMovie(subnodes[2].firstChild.toString())
this.ref["holder_mc"+i].my_sound.loadSound(subnodes[3].firstChild.toString(), true);
}
} else trace("Error loading XML document")
}
And here is the code for the button:
on (release) {
var lo = new Object();
var mcl = new MovieClipLoader();
var my_sound:Sound = new Sound();
mcl.addListener(lo);
lo.onLoadInit = function() {
};
mcl.loadClip(Link_txt0, "_root.mainMovie");
my_sound.start(Sound_mc0, 99);
button_mc.onRelease = function() {
};
}
And here’s the XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data[
<!ELEMENT title (comments, link, image, sound)>
<!ATTLIST title name CDATA #REQUIRED>
<!ELEMENT comments (#PCDATA)>
<!ELEMENT link (#PCDATA)>
<!ELEMENT image (#PCDATA)>
<!ELEMENT sound (#PCDATA)>
]>
<data>
<title name="name">
<comments>text here</comments>
<link>file.swf</link>
<image>images/imageName_sm.jpg</image>
<sound>soundfile.mp3</sound>
</title>
<title name="name">
<comments>text here</comments>
<link>file.swf</link>
<image>images/imageName_sm.jpg</image>
<sound>soundfile.mp3</sound>
</title>
<title name="name">
<comments>text here</comments>
<link>file.swf</link>
<image>images/imageName_sm.jpg</image>
<sound>soundfile.mp3</sound>
</title>
<title name="name">
<comments>text here</comments>
<link>file.swf</link>
<image>images/imageName_sm.jpg</image>
<sound>soundfile.mp3</sound>
</title>
<title name="name">
<comments>text here</comments>
<link>file.swf</link>
<image>images/imageName_sm.jpg</image>
<sound>soundfile.mp3</sound>
</title>
</data>