0

我正在将多个 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);
4

1 回答 1

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);
于 2011-10-24T16:02:17.297 回答