0

我正在尝试将其添加到安排中,但只有最后添加的图像出现在我面前,目标是同时在屏幕上显示多个图像。

到目前为止,这是我的代码

import flash.display.Sprite;

var sprites:Array = [];
var lista_paises_imagenes:Array = new Array("ar.png","br.png","ch.png","co.png");
for(var i = 0;i < lista_paises_imagenes.length;i++){
    var direcimg:URLRequest = new URLRequest("Palabras/Paises/"+lista_paises_imagenes[i]);
    var objload:Loader = new Loader();
    sprites.push(new Sprite());
    objload.load(direcimg);
    objload.contentLoaderInfo.addEventListener(Event.COMPLETE,CargaImg);
}

var xx:Number = 0;
var xy:Number = 0;
function CargaImg(eve:Event):void{
    sprites[xx].addChild(objload.content);
    sprites[xx].x = xy;
    sprites[xx].y = 255;
    //sprites[xx].height = 90;
    //sprites[xx].width = 90;
    addChild(sprites[xx]);
}
trace(stage.numChildren)
trace(sprites.length);

由于 numChildren 在舞台上仅完成 1 个对象 Imgae

4

0 回答 0