PDA

View Full Version : loading a movieclip with XML


Jacobb123
07-16-2008, 11:05 PM
I am new to actionscript and I am trying to load a movieclip from an xml document. I have the following code




var reviews_xml:XML = new XML();
reviews_xml.ignoreWhite = true;

reviews_xml.onLoad = function (success:Boolean):Void {
if (success) {
var image:String = this.firstChild.firstChild.childNodes[2].firstChild;
trace(this.firstChild.firstChild.childNodes[2].firstChild)
trace(image);
this.loadMovie(image);

}

}


reviews_xml.load("http://127.0.0.1/~jacobbillings/xspf/212.xml");


My XML file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<trackList>
<track>
<title>adklfalsdkfs</title>
<location>http://store.labelfreeartists.com/data/mp3/212Mercy Me-I Can Only Imagine.mp3</location>
<image>http://127.0.0.1/~jacobbillings/images/themixthomas.jpg</image>
<info>http://labelfreeartists.com</info>
<lyrics>view_lyrics.php?id=161</lyrics>
<add>add_song.php?id=161&member_id=212</add>
<rate>rate.php?id=161</rate>
</track>
</trackList>

ramm19
07-17-2008, 12:10 AM
Jacobb,

A couple things...:

0) you didn't explain if it's working or not, or what error you see... please give more details.

1)Post the result for "trace(image); "

2) It's best to use relative URLs when possible.

3) "this.loadMovie(image);" <--- this line seems to be wrong, where are you loading the images? you need to specify a MC instance name.

Jacobb123
07-17-2008, 08:53 PM
Sorry for the lack of info...

Trace image outputs the URL.

I did figure out that I needed a an MC instance so I created one and set it on the root timeline and it seems to work fine now. Like I said I am new to Actionscript and there are things that I have yet to figure out.. Thanks anyway

ramm19
07-17-2008, 09:01 PM
np, that's a great start, Flash and XML is not all that easy ;)