I have code that plays a random swf file from an array.
stop();
var movieArray:Array = [‘home lotus’,‘recall’,‘doors’];
var loader:Loader = new Loader();
var index:int = movieArray.length * Math.random();
var url:String = movieArray[index] + ‘.swf’;
trace(“Attempting to load”, url);
loader.load(new URLRequest(url));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);
addChild(loader);
function loaderComplete(e:Event):void {
trace(“Successfully loaded”, url);
}
function loaderIOError(e:IOErrorEvent):void {
trace(“Failed to load”, url);
}
essentially, I want to be able to load the movie with a button.
Click–>load random swf file
any help would be awesome