我想创建swf文件,按顺序加载所有其他1.swf,2.swf,3,4等等,然后再循环到第一个。
问题:这是输出"准备调用eFrame TypeError:错误#1009:无法访问空对象引用的属性或方法。 在main_fla :: MainTimeline / eFrame()"
这就是我所拥有的(BTW它不是我的代码:)问题是在这部分代码中
mcExternal = loader.content as MovieClip; var current:int = mcExternal.currentFrame; var total:int = mcExternal.totalFrames;
import flash.display.MovieClip;
var rq:URLRequest;
var loader:Loader= new Loader();
stage.addChild(loader);
var numOfMovies:int = 3;
var path:String = "mov/";
var myMovies:Array=["1.swf","2.swf", "3.swf"];
var movieNum:int=1;
var mcExternal:MovieClip;
/*Load Req*/
function loadSWF():void {
var tPath:String = path + movieNum;
rq=new URLRequest(tPath + ".swf");
loader.load(rq);
// waiting for the loader to be ready
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplet);
}
/*Load Req*/
function onComplet(e:Event):void {
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,onComplet);
trace("ready to call eFrame");
stage.addEventListener(Event.ENTER_FRAME, eFrame);
}
function eFrame(e:Event):void {
mcExternal= loader.content as MovieClip;
var current:int=mcExternal.currentFrame;
var total:int=mcExternal.totalFrames;
/*trace(current);
trace(total);*/
if (current >= total) {
trace("Load next swf ");
loader.unloadAndStop();
mcExternal=null;
movieNum++;
stage.removeEventListener(Event.ENTER_FRAME, eFrame);
rq=null;
loadSWF();
if (movieNum>=numOfMovies) {
movieNum=0;
}
}
}
loadSWF();