您究竟作为外部资源加载了什么。如果它是 SWF,那么那里有什么东西。此外,我建议在加载 swf 后附加侦听器。即在 Event.COMPLETE 处理程序中。这是文档中的代码:
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;
public class LoaderExample extends Sprite {
private var url:String = "Image.gif";
public function LoaderExample() {
var loader:Loader = new Loader();
configureListeners(loader.contentLoaderInfo);
loader.addEventListener(MouseEvent.CLICK, clickHandler);
var request:URLRequest = new URLRequest(url);
loader.load(request);
addChild(loader);
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(Event.INIT, initHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(Event.UNLOAD, unLoadHandler);
}
private function completeHandler(event:Event):void {
trace("completeHandler: " + event);
}
private function httpStatusHandler(event:HTTPStatusEvent):void {
trace("httpStatusHandler: " + event);
}
private function initHandler(event:Event):void {
trace("initHandler: " + event);
}
private function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
}
private function openHandler(event:Event):void {
trace("openHandler: " + event);
}
private function progressHandler(event:ProgressEvent):void {
trace("progressHandler: bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
}
private function unLoadHandler(event:Event):void {
trace("unLoadHandler: " + event);
}
private function clickHandler(event:MouseEvent):void {
trace("clickHandler: " + event);
var loader:Loader = Loader(event.target);
loader.unload();
}
}
}
所以尝试在 completeHandler 方法中附加监听器。