本教程这里有一段代码用as2加载外部swf:代码如下:
var swfLoader:MovieClipLoader = new MovieClipLoader();
var loadingListener:Object = new Object();
swfLoader.addListener(loadingListener);
loadingBtn_mc.onRelease = function()
{
swfLoader.loadClip("slides.swf",container_mc);
this._visible = false;
};
loadingListener.onLoadStart = function(container:MovieClip):Void
{
trace("The MovieClip " + container + " started loading");
loadingProgress_mc._x = 126;
loadingProgress_mc._y = 135;
};
loadingListener.onLoadProgress = function(container:MovieClip, bytLoaded:Number, bytTotal:Number):Void
{
var percentageLoaded:Number = (bytLoaded / bytTotal) * 100;
loadingProgress_mc.percentage_txt.text = String(Math.floor(percentageLoaded));
trace("Loading progress = " + String(Math.floor(percentageLoaded)));
};
loadingListener.onLoadComplete = function(container:MovieClip):Void
{
trace("The MovieClip " + container + " has completed loading");
loadingProgress_mc._x = -200;
};
loadingListener.onLoadInit = function(container:MovieClip):Void
{
trace("The MovieClip " + container + " has been initialized");
};
loadingListener.onLoadError = function(container:MovieClip, errorCode:String):Void
{
trace("Error loading the file. Error code = " + errorCode);
};
要卸载 swf(一旦加载),我添加了:
unloadingBtn_mc.onRelease = function()
{
swfLoader.unloadClip(container_mc);
//this._visible = false;
};
但是如何将参数传递给“slides.swf” swfLoader.loadClip("slides.swf",container_mc);
?