将swf加载到特定图层中

时间:2011-10-24 15:33:20

标签: actionscript-3 flash-cs5 flash urlloader

我正在将多个swfs加载到容器swf中,我如何确定哪个swf在另一个上面?目前我正在加载这样的swf:

var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("example.swf");

myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
function progressListener (e:ProgressEvent):void{
if (e.bytesLoaded == 0){
    //Upload loading status to zero
}else{
    //Upload loading status
}
}

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, startListener);
function startListener (e:Event):void{
addChild(myLoader.content);
}

myLoader.load(url);

1 个答案:

答案 0 :(得分:1)

目前,它们被绘制到屏幕的顺序取决于首先完成加载的文件。

您可以在加载另一个文件后,在前台下载所需的swf文件:

function startListener(e:Event):void
{
    addChild(myLoader.content);
    myLoader.load("url_of_the_swf_in_front");
}

或者您之后可以更改z-index:

stage.setChildIndex(foregroundSwf, stage.numChildren -1);
相关问题