Hi,
I have a Movie Clip on my time line that has an empty movieclip inside it which I whish to load a random external SWF file into. There is to be an unknown number of SWF’s to load in and these are to be played one after the other. So when the first random SWF is finished playing the next random SWF is to start playing.
Here is the hierarchy of my file
|_ Timeline
|_ plasmaScreen_mc
|_ emptyMovieClip (instance name advert)
So on my empty movie clip I have an onClipEvent which loads in the file path of the External SWF from an XML file and tries to load the extrernal file. Here is my code
onClipEvent(enterFrame)
{
if(this._currentframe == this._totalframes)
{
var plasmaXML:XML = new XML();
// Ignore any formatting and irrelevant whitespace in the document
plasmaXML.ignoreWhite = true;
pasmaXML.load("plasma_screen.xml");
plasmaXML.onLoad = function(success)
{
if (success)
{
var plasma = plasmaXML.firstChild;
var adverts = plasma.childNodes;
var numAds:Number = adverts.length;
var index:Number = Math.floor(Math.random() * (numAds - 0));
var filename:String = adverts[index].attributes.adfilename;
// Load the file
loadMovie(filename,this);
}
}
}
}
Unfortunately because the code for getting data from the XML file is included in the onClipEvent “this” now refers to the XML data and not the movieclip. Can anyone tell me how I can proceed. I need to pass the filename to movieclip.