# Trying to get external .swf via XML

**URL:** <https://forum.kirupa.com/t/trying-to-get-external-swf-via-xml/215522>\
**Category:** Uncategorized\
**Created:** [February 7, 2007, 10:24pm UTC](https://forum.kirupa.com/t/trying-to-get-external-swf-via-xml/215522 "2007-02-07T22:24:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FilmGrrl](https://avatars.discourse-cdn.com/v4/letter/f/6a8cbe/32.png) [@FilmGrrl](https://forum.kirupa.com/u/FilmGrrl)\
**Post date:** [February 7, 2007, 10:24pm UTC](https://forum.kirupa.com/t/trying-to-get-external-swf-via-xml/215522/1 "2007-02-07T22:24:05Z")

</div>

Hey all, this is my first post. And I’ve been googling till my eyes have gone cuckoo. I’m trying to pull in an external SWF file that loads into a movieclip holder by clicking a button.

Here is the actionscript I have in the timeline:

//Create the XML Object  
myXML = new XML()  
myXML.ignoreWhite = true  
//Load XML file  
myXML.load(“seminars.xml”)  
//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[“holder\_mc”+i].loadMovie(subnodes[2].firstChild.toString())  
}  
} else trace(“Error loading XML document”)  
}

* * *

Here is the actionscripting for the button:

on (release) {  
var lo = new Object();  
var mcl = new MovieClipLoader();  
mcl.addListener(lo);  
lo.onLoadInit = function() {  
\_root.mainMovie.\_width = 444;  
\_root.mainMovie.\_height = 270;  
};  
mcl.loadClip(Link\_txt0, “\_root.mainMovie”);  
button\_mc.onRelease = function() {  
\_root.mainMovie.\_width = 444;  
\_root.mainMovie.\_height = 270;  
};  
}

* * *

And here’s my XML code:

\<?xml version=“1.0” encoding=“UTF-8”?\>  
\<!DOCTYPE data[  
\<!ELEMENT title (comments, link, image)\>  
\<!ATTLIST title name CDATA #REQUIRED\>  
\<!ELEMENT comments (#PCDATA)\>  
\<!ELEMENT link (#PCDATA)\>  
\<!ELEMENT image (#PCDATA)\>  
]\>  
\<data\>  
\<title name=“Person’s Name”\>  
\<comments\>Company Name\</comments\>  
\<link\>flashfile.swf\</link\>  
\<image\>images/imagename\_sm.jpg\</image\>  
\</title\>  
\<title name=“Person’s Name”\>  
\<comments\>Company Name\</comments\>  
\<link\>flashfile.swf\</link\>  
\<image\>images/imagename\_sm.jpg\</image\>  
\</title\>  
\<title name=“Person’s Name”\>  
\<comments\>Company Name\</comments\>  
\<link\>flashfile.swf\</link\>  
\<image\>images/imagename\_sm.jpg\</image\>  
\</title\>  
\<title name=“Person’s Name”\>  
\<comments\>Company Name\</comments\>  
\<link\>flashfile.swf\</link\>  
\<image\>images/imagename\_sm.jpg\</image\>  
\</title\>  
\<title name=“Person’s Name”\>  
\<comments\>Company Name\</comments\>  
\<link\>flashfile.swf\</link\>  
\<image\>images/imagename\_sm.jpg\</image\>  
\</title\>  
\<title name=“Person’s Name”\>  
\<comments\>Company Name\</comments\>  
\<link\>flashfile.swf\</link\>  
\<image\>images/imagename\_sm.jpg\</image\>  
\</title\>  
\<title name=“Person’s Name”\>  
\<comments\>Company Name\</comments\>  
\<link\>flashfile.swf\</link\>  
\<image\>images/imagename\_sm.jpg\</image\>  
\</title\>  
\</data\>

* * *

The text, comments & holder\_mc all load fine. I just can’t get the .swf to load into the holder on a button click. (grrr)

Thanks in advance for any help.

M.
