Tengo un archivo indice.fla que requiere carga a otros archivos: tema_1.fla, tema_2.fla, etc.
En el Docuement Class: Clase_main_load.as tiene lo siguiente:
Código :
public var tema_1:String = "temas_aire/tema_1.swf"; Y en el boton para cargar el tema_1: var loader:LoadDisplayObject = new LoadDisplayObject(tema_1, true); addChild(loader);
La Clase LoadDisplayObject tiene este codigo:
Código :
package {
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
public class LoadDisplayObject extends Sprite {
private var _loader:Loader;
private var _loaderInfo:LoaderInfo;
private var _verbose:Boolean = false;
private var _loadProgressString:String = "";
private var _bytesLoaded:Number = 0;
private var _bytesTotal:Number = 0;
public function LoadDisplayObject(path:String, verbose:Boolean) {
_verbose = verbose;
_loader = new Loader();
_loader.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
_loaderInfo = _loader.contentLoaderInfo;
_loaderInfo.addEventListener(Event.OPEN, onOpen, false, 0, true);
_loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress, false, 0, true);
_loaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatusEvent, false, 0, true);
_loaderInfo.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
_loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
_loaderInfo.addEventListener(Event.INIT, onInit, false, 0, true);
_loaderInfo.addEventListener(Event.UNLOAD, onUnloadContent, false, 0, true);
try {
_loader.load(new URLRequest(path));
} catch (err:Error) {
trace("No es posible cargar el contenido:\n" + err.message);
}
}
private function onClick(evt:MouseEvent):void {
if (evt.target == "[object Btn_salir]") {
_loader.unload();
}
}
private function onComplete(evt:Event):void {
_loaderInfo.removeEventListener(Event.OPEN, onOpen);
_loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
_loaderInfo.removeEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatusEvent);
_loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
_loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
addChild(_loader);
dispatchEvent(new Event("displayObjectLoaded"));
}
private function onProgress(evt:ProgressEvent):void {
var loadPercent:int = Math.round((evt.bytesLoaded/evt.bytesTotal)*100);
_bytesLoaded = Math.floor(evt.bytesLoaded / 1024);
_bytesTotal = Math.floor(evt.bytesTotal / 1024)
_loadProgressString = ("Cargando tema: " + loadPercent + " % Cargado: " + _bytesLoaded + " KB de " + _bytesTotal + "KB");
if (_verbose) { trace(_loadProgressString); }
}
public function get progressString():String {
return _loadProgressString
}
public function get progressNumberArray():Array {
return [_bytesLoaded, _bytesTotal];
}
private function onOpen(evt:Event):void {
if (_verbose) { trace("Inicia la carga"); }
}
private function onHTTPStatusEvent(evt:HTTPStatusEvent):void {
if (_verbose) { trace("HTTP status code: " + evt.status); }
}
private function onIOError(evt:IOErrorEvent):void {
if (_verbose) { trace("Ocurrio un error en la carga::\n", evt.text); }
}
private function onInit(evt:Event):void {
_loaderInfo.removeEventListener(Event.INIT, onInit);
if (_verbose) {
trace("Contenido inicializado. Propiedades:");
trace(" url:", evt.target.url)
trace(" Same Domain:", evt.target.sameDomain)
if (evt.target.contentType == "application/x-shockwave-flash") {
trace(" SWF Version:", evt.target.swfVersion)
trace(" AS Version:", evt.target.actionScriptVersion)
trace(" Frame Rate:", evt.target.frameRate)
}
}
}
private function onUnloadContent(evt:Event):void {
_loaderInfo.removeEventListener(Event.UNLOAD, onUnloadContent);
if (_verbose) { trace("unLoadHandler:\n", evt); }
}
}
}
Al ejecutar el archivo indice.swf y tratar de cargar al archivo tema_1.swf
Aparece lo siguiente:
Código :
Inicia la carga Cargando tema: 0 % Cargado: 0 KB de 337KB Cargando tema: 19 % Cargado: 64 KB de 337KB Cargando tema: 38 % Cargado: 128 KB de 337KB Cargando tema: 57 % Cargado: 192 KB de 337KB Cargando tema: 76 % Cargado: 256 KB de 337KB Cargando tema: 95 % Cargado: 320 KB de 337KB Cargando tema: 100 % Cargado: 337 KB de 337KB Contenido inicializado. Propiedades: url: file:///E|/A%5FAA%5FFerromex%5FVideo%5FVER%5F3.0/tema_mclips.swf Same Domain: true SWF Version: 9 AS Version: 3 Frame Rate: 12 HTTP status code: 0
Y después aparece el error:
Código :
Error #2044: IOErrorEvent no controlado: text=Error #2035: No se encuentra la dirección URL.
NOTA:
Cuando se ejecuta el tema_1.swf en forma individual corre bien, pero cuando lo trato de cargar desde indice.swf aparece el error.
Alguna idea o sugerencia
