Hi, I’m trying to load external swfs dynamically into empty movie clips from a list in a xml file.
Problem is that I want only one to appear at a time, while the others are paused. I also want to randomise which gets shown. I’ve got most of it to work but for some reason I cant turn off (using ._visible) the individual movies, so I’m thinking I have got multiple instances to begin with.
Can anyone please help?
Thanks greatly!
var x:XML = new XML();
x.ignoreWhite = true;
//array containing the location of swfs
var urls:Array = new Array();
//variable stating which is the current swf displayed
var current:Number = 0;
var randomNum:Number = 0;
var max:Number = 0;
//loads url from XML to array and loads first swf into holder clip on stage.
x.onLoad = function()
{
var swfs:Array = this.firstChild.childNodes;
for(i=0; i<swfs.length; i++)
{
urls.push(swfs*.attributes.url);
_root.createEmptyMovieClip(“swf”+ i,i);
loadImage();
}
max = urls.length;
randomise();
turnOn();
current = randomNum;
}
//loads XML
x.load(“swfList.xml”);
turnOn = function()
{
//this._visible = true;
}
loadImage = function()
{
loadMovie(urls*,[“swf”+i]);
this._visible = 0;
}
//triggers the next swf
nextSwf = function()
{
//this is where i will work out how to get the next one going… This function is called from within the individual swfs
}
//returns a random number between 0 and the total number of swfs in XML
randomise = function()
{
while (current == (i = random(max)))
{
i = random(max)
}
randomNum = i
}