import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
// Ruta de los archivos SWF disponibles
var swfFiles:Array = ["archivo1.swf", "archivo2.swf", "archivo3.swf"];
// Genera un número aleatorio para seleccionar un archivo SWF
var randomIndex:int = Math.floor(Math.random() * swfFiles.length);
var selectedSWF:String = swfFiles[randomIndex];
// Crea un cargador y una solicitud para cargar el archivo SWF seleccionado
var loader:Loader = new Loader();
var request:URLRequest = new URLRequest(selectedSWF);
// Agrega eventos de progreso y finalización de carga
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
// Carga el archivo SWF
loader.load(request);
// Función de progreso de carga
function onProgress(event:ProgressEvent):void {
var loadedBytes:uint = event.bytesLoaded;
var totalBytes:uint = event.bytesTotal;
var percentLoaded:Number = loadedBytes / totalBytes * 100;
// Actualiza aquí el indicador de progreso en tu interfaz
}
// Función de finalización de carga
function onComplete(event:Event):void {
// Remueve los eventos de progreso y finalización de carga
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onComplete);
// Accede al contenido cargado y añádelo a tu escenario
var loadedContent:* = loader.content;
addChild(loadedContent);
}