I hava some actionscript code.
(Thanks kirupa team - it’s from xml mp3 player)
What i wanted:
Anywhere in movie i insert this code in a frame, make needed buttons and movies and then this code will generate list of buttons (from template) with names and link to my files, according to my xml file.
All is very good:
list of buttons generates, all file names are correct,
according to command trace(); all links are created correct.
And there no error displayed in flash 8.
**BUT WHEN I CLICK ANY BUTTON I ALWAYS GO TO THE LINK ENTERED
IN LAST XML STRING.
(according to xml shown below, it’s always file2.zip)
**
Here is the gode for a frame:
XMLNode.prototype.moveBefore = function(beforeNode){
if (this == beforeNode) return (0);
beforeNode.parentNode.insertBefore
(this.cloneNode(true),beforeNode);
this.removeNode();
}
///////DOWNLOAD LINKS/////////
var down_spacing = 20;
GenerateFileListing = function(download_xml, target_mc){
target_mc = target_mc.createEmptyMovieClip("list_mc",1);
var files = download_xml.firstChild.childNodes;
for (var i=0; i<files.length; i++){
var get_mc = target_mc.attachMovie("get", "get"+i, i);
get_mc._y = i*down_spacing;
get_mc.node = files*;
get_mc.title_txt.text = files*.attributes.title;
var filename = files*.attributes.url;
get_mc.down_btn.onRelease = function () {
getURL("http://uneed.ru/download/"+ filename +"", "_blank");
}
////////SHOW IN PROGRAMM THE LINKS////
var showlinks = 'http://uneed.ru/download/'+ filename +''
trace (showlinks);
////////SHOW IN PROGRAMM THE LINKS///
}
}
var download_xml = new XML();
download_xml.ignoreWhite = true;
download_xml.onLoad = function(success){
if (success){
GenerateFileListing(this,download_mc);
}else trace("Error loading XML file");
}
download_xml.load("download.xml");
**Here is what xml file contains:
**
<?xml version="1.0" ?>
<playlist>
<song title="file1" url="file1.zip"></song>
<song title="file2" url="file2.zip"></song>
</playlist>
**
PLEASE ANYBODY HELP ME WITH THIS BUG(i think so).
all my project stoped 5 day ago…:*(
Here is the source codes:**
http://www.uneed.ru/links.zip