# Need help with an xml radio file and path settings when loading into a seperate movie

**URL:** <https://forum.kirupa.com/t/need-help-with-an-xml-radio-file-and-path-settings-when-loading-into-a-seperate-movie/146973>\
**Category:** Uncategorized\
**Created:** [May 5, 2005, 8:14pm UTC](https://forum.kirupa.com/t/need-help-with-an-xml-radio-file-and-path-settings-when-loading-into-a-seperate-movie/146973 "2005-05-05T20:14:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![indierockmedia](https://avatars.discourse-cdn.com/v4/letter/i/7ab992/32.png) [@indierockmedia](https://forum.kirupa.com/u/indierockmedia)\
**Post date:** [May 5, 2005, 8:14pm UTC](https://forum.kirupa.com/t/need-help-with-an-xml-radio-file-and-path-settings-when-loading-into-a-seperate-movie/146973/1 "2005-05-05T20:14:41Z")

</div>

hi. i am modifying the radio script found at  
[http://www.onclipevent.com/radio/](http://www.onclipevent.com/radio/)

i customized my own version and the one at onclipevent works fine. but i am loading my radio into an empty movie clip in another movie and its not working. the radio knobs work, but the music doesnt load. im guessing i have to put \_root.blah blah blah somewhere in the code to make it work.

right now i have a movie, test.swf, that has an empty movie clip named “radio” test.swf loads radionew.swf (the actual radio) into the “radio” empty movie clip. this is where things stop working. the radionew.swf works fine on its own, but not when i load it into test.swf. can someone look at the action script and tell me what ive done wrong? ive included all the files and directory structure in a zip file at:

[http://www.bandphotography.com/testradio.zip](http://www.bandphotography.com/testradio.zip) (711kb)

the empty movie clip that loads the music into the “music” empty movie clip in radio.swf is at frame 20 of the music layer.

any help would be appreciated!

mikey

===================

here is the action script for the radio.

fscommand (“allowscale”, “false”);  
//check version for flash 4 player or lower  
version = getVersion();  
if (substring(version, 1, 3) == “WIN” || substring(version, 1, 3) == “MAC”){  
majorVersion = int(substring(version, 5,1));  
}else if (substring(version, 1, 3) == “UNI”){  
//for unix or linux versions  
majorVersion = int(substring(version, 6,1));  
}  
//trace (majorVersion);  
if (majorVersion \< 5){  
//trace (“lowly”);  
getURL(“[http://www.macromedia.com/shockwave/download/index.cgi?P1\_Prod\_Version=ShockwaveFlash](http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash)”, “\_blank”);  
}

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*//  
// Movieclip Class Extensions //  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*//  
//  
// rotate the knob  
Movieclip.prototype.rotate = function () {  
var point = {x:this.\_x, y:this.\_y}  
this.\_parent.localToGlobal(point);  
//Distance between Reg Point and Mouse  
var deltaX = \_root.\_xmouse - point.x;  
var deltaY = \_root.\_ymouse - point.y;  
//Calculate Rotation Angle using atan2()  
var myRotationRad = Math.atan2(deltaY, deltaX);  
// convert radians to degrees  
var myRotationDeg = 180 \* myRotationRad/Math.PI;  
// set rotation  
//trace (myRotationDeg);  
//  
//do not allow the knob to turn from final position straight to init position or vice versa  
//  
if (myRotationDeg \< 20 && this.\_rotation \>20 && this.\_rotation \< 170){  
//do nothing  
}else if (myRotationDeg \> 0 && this.\_rotation \<0 && this.\_rotation \> -170){  
//do nothing  
}else{  
this.\_rotation = myRotationDeg;  
}  
};

// get the load status of a movieclip  
Movieclip.prototype.getPercentLoaded = function(){  
var totalBytes = this.getBytesTotal();  
var bytesLoaded = this.getBytesLoaded();  
var percentLoaded = bytesLoaded/totalBytes_100;  
return percentLoaded;  
};  
// get the playhead position of a movieClip in percent value  
Movieclip.prototype.getPercentPlayed = function(){  
var totalFrames = this.\_totalframes;  
var framesPlayed = this.\_currentframe;  
if (totalFrames && totalFrames !=0){  
var percentPlayed = framesPlayed/totalFrames_100;  
}  
return percentPlayed;  
};  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*_//  
// functions //  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*//  
//set global sound volume  
//max vol is 180  
//init sound object  
mySound = new Sound();  
function setRadioVolume(value){  
var maxVol = 180;  
var minVol =0;  
if (value \< 0){  
value += 360;  
}  
myVolume = maxVol - maxVol_ value/360;  
mySound.setVolume (myVolume);

}  
function getPlayList (url){  
myPlayList = new XML();  
//Branden’s XML Nitro ensures that the ignoreWhite Works on all versions of the plugin  
myPlayList.ignoreWhite = true;  
myPlayList.load(url);  
myPlayList.onLoad = makePlaylist;  
}  
function makePlayList(){  
//Hardwired XML reader to read the XML playlist.  
//First get the number of songs  
songNos = myPlayList.firstChild.firstChild.childNodes.length;  
//trace ("Number of songs = " +songNos);  
//create playlist object  
PlayList = {}; //new object created  
PlayList.Songs = new Array(); //new array created in the songs object  
//songlist is xml with only songs  
songList = new XML();  
songList = myPlayList.firstChild.firstChild;  
mySong = songList.firstChild;  
//trace (mySong);  
//trace (songList);  
for (var i=0; i\<songNos; i++){  
[//PlayList.Songs](https://PlayList.Songs)\* = “Song” + i;  
PlayList.Songs[“name” + i] = mySong.firstChild.firstChild.nodeValue;  
PlayList.Songs[“src” + i] = mySong.firstChild.nextSibling.firstChild.nodeValue;  
PlayList.Songs[“artist” + i] = mySong.firstChild.nextSibling.nextSibling.firstChild.nodeValue;  
mySong = mySong.nextSibling;  
//trace (PlayList.Songs[“name” + i])  
//trace (PlayList.Songs[“src” + i])  
//trace (PlayList.Songs[“artist” + i])  
}  
}  
function getNextFromList(){  
if (playerCount \>= (songNos-1) || playerCount eq “”){  
//init playerCount  
playerCount = 0;  
}else{  
playerCount +=1;  
}  
//trace (“gettingNext” + PlayList.Songs[“src0”]);  
loadMovie(PlayList.Songs[“src”+playerCount], “music”);  
}  
// distribute the songs over the available channels  
function setFrequency(value){  
var maxSongs = songNos;  
var minSongs =0;  
if (value \< 0){  
value += 360;  
}  
mySong = int(maxSongs - maxSongs\* value/360);  
//if the song frequeny is different get new song  
if (playerCount != mySong){  
playerCount = mySong-1;  
getNextFromList();  
}  
//trace (mySong);  
}  
//play static during tuning  
function getStatic(){  
static = new Sound();  
rnd = random(4)+1;  
//trace (rnd)  
static.attachSound(“static”+rnd);  
static.start();  
}  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*//  
// extras //  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*//  
//Branden’s Killer XML parser  
//For more info check [http://chattyfig.figleaf.com/~bhall/killastuff/XMLnitro.as](http://chattyfig.figleaf.com/~bhall/killastuff/XMLnitro.as)  
#include “XMLnitro.as”
