自从我开始调试我的代码以使其工作以来,已经有 2 天了,而且它正在占用我所有的时间,如果我不开始询问,我认为我不会达到我的最后期限。
我不是专业人士,所以请对代码保持温和。:D
图库运行良好,可以顺利加载缩略图而不会返回任何错误。但是,缩略图没有按预期加载,我认为是因为最小的文件大小首先加载。因此,如果 thumbnail[3] 是最小的,它将自己附加到 thumbnail_container[0] ,它应该始终是 thumbnail[0] 到 thumbnail_container[0] 等等。
这是我的代码:
//THIS IS THE CONTAINER
for (var i:int = 0; i < thumbBatches[aj]; i++)
{
thumbX = 44.35 + (thumbWidth + 18) * i;
var itemThumb:thumbH = new thumbH();
itemThumb.x = thumbX;
itemThumb.y = thumbY;
itemThumb.name = "" + i + (8 * aj);
itemThumb.addEventListener(MouseEvent.CLICK, openFullItem);
level2.addChild(itemThumb);
IthumbList[i + (8 * aj)] = itemThumb;
}
//THIS WILL LOAD THE THUMBNAILS
for (var n:int = 0; n < potteryIDnum.length; n++)
{
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
imgLoader.load(new URLRequest(potteryThumbs[n]));
}
// AFTER LOADING IT, IT'LL BE ASSIGNED TO AN ARRAY
// THEN AFTER THE LAST IMAGE HAS BEEN LOADED WILL BE ATTACHED TO THE CONTAINER
function loadComplete(e:Event):void
{
IthumbImages.push(e.target.content);
if (IthumbList.length == IthumbImages.length)
{
for (var k:int = 0; k < IthumbImages.length; k++)
{
var fadeInThumbs:Tween = new Tween(IthumbList[k],"alpha",Strong.easeInOut,0,1,0.3 * (k + 0.5),true);
IthumbList[k].addChild(IthumbImages[k]);
}
}
}
提前致谢!