Hi,
i just tried to post this in the forum and my IE crashed, so forgive me if i double post. im trying to get this script to call different results from my onRelease depending on what button has been pressed. you will need a movieclip in your library with the linkage “button” and a textbox inside it called myText. Any help with this would be greatly appreciated.
stop();
/* Format XML text (Might not be necessary for this project)
targetClip.myText.html = true;
targetClip.myText.wordWrap = true;
targetClip.myText.multiline = true;
targetClip.myText.label.condenseWhite = true;
/
/ Apply CSS
playlistStyle = new TextField.StyleSheet();
playlistStyle.load(“playlist.css”);
targetClip.myText.styleSheet = playlistStyle;
/
// Parse XML
songPlaylist = new XML();
songPlaylist.ignoreWhite = true;
songPlaylist.load(“playlist.xml”);
songPlaylist.onLoad = function(success) {
// XML Variables
var playlist = songPlaylist.firstChild;
var songs = playlist.childNodes;
var songCount = songs.length;
//
if (success) {
createPlaylist(songCount, songs);
} else {
trace(“XML file did not load, please refresh your browser.”);
}
};
//
// create buttons for xml
createPlaylist = function (songCount, songs) {
for (i=0; i<songCount; i++) {
// Variables (XML attributes)
var myArtist = songs.attributes.artist;
var myTitle = songs*.attributes.title;
var myURL = songs*.attributes.url;
// Attach button movieclips
targetClip = this.attachMovie(“button”, i, i);
// Position Clips
targetClip._x = 10;
targetClip._y = 5+(i*25);
// Populate myText
targetClip.myText.text = myArtist+" - "+myTitle;
// Event Handlers and Mouse Events
targetClip.onRollOver = onRollOverHandler;
targetClip.onRollOut = onRollOutHandler;
targetClip.onRelease = onReleaseHandler;
}
};
// Events
onRollOverHandler = function () {
this.gotoAndStop(“rollOver”);
};
onRollOutHandler = function () {
this.gotoAndStop(“rollOut”);
};
onReleaseHandler = function () {
// should trace back an index number relative to the button released.
};
(Here’s the accompying xml files called playlist.xml)
<?xml version=“1.0” encoding=“ISO-8859-1”?>
<playlist>
<song artist =“King Tubby” title =“Hi-Grade Dub” url ="/songs/song1.mp3"/>
<song artist =“Scientist” title =“Ganga Dub” url ="/songs/song2.mp3"/>
<song artist =“Massive Attack” title =“Karmacoma” url ="/songs/song3.mp3"/>
<song artist =“Sly & The Family Stone” title =“Sexy Situation” url ="/songs/song4.mp3"/>
<song artist =“Leeroy Brown” title =“Metro Pigs” url ="/songs/song5.mp3"/>
</playlist>