English 中文(简体)
AS3:等待多载荷完成
原标题:AS3: waiting for multiple loaders to complete

我要装满的图像是任意的。 我想要装上他们,等到我做事。 国家投资和技术研究所为每个机构提供服务,然后才着手实施方案的其他部分。

我知道,我可以做这件事。 INIT听众更新并检查了一些变量,但标准做法是不是的? 是否有更强或更具体的方式?

最佳回答

The best way is to use LoaderMax, developed by greensock (the developer of TweenMax).

http://www.greensock.com/loadermax/

你可以建立一个装货组,等待该组的完全活动。 法典有很好的记载。

这里是迅速修改法典,让大家了解你可以期望的东西:

mediaLoader = new LoaderMax( { name:"mediaLoader" } );
mediaLoader.addEventListener(LoaderEvent.PROGRESS, onMediaLoadProgress);
mediaLoader.addEventListener(LoaderEvent.COMPLETE, onMediaLoadComplete);
mediaLoader.addEventListener(LoaderEvent.ERROR, onMediaLoadError);

for (var i:int = 0; i < 10; i++)
{
    mediaLoader.append(LoaderMax.parse("image_" + i + ".jpg", { estimatedBytes: 100000 }));
}

这还给您提供图像、录像、声音等专业装货机。 你们可以利用你的优势,或者以透明的方式对待他们。

问题回答

您可以在一个阵列中储存每个装载器,并在派遣国际船舶和公司时将其拆除。

private function onInit(e:Event):void
{
  var loader:Loader = (e.currentTarget as LoaderInfo).loader;
  _loaders.splice(_loaders.indexOf(loader), 1);
  if (_loaders.length == 0)
    //do something
}

You could also just use a count variable as you say. This is ok since a loader won t dispatch INIT twice. But you will have to remove the loader from the array or decrease your counter on the error events as well.

没有标准做法。 你们自己必须执行《宣言》,正如“Kodiak”所说。

But take a look at LoaderMax library if you need something more complex. You can set maxConnections parameter to determine how many stuffs it is loading at one time.





相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Sorting twodimensional Array in AS3

So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

Red5 Security Tutorial

I am looking for a step by step tutorial on securing Red5 from intrusion. This seems to be a question that comes up alot in a google search, but is never really answered in a way that makes sense to ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

visible property of DisplayObject

For example I have a hierarchy of movie clips. mc1 is a child of mc, and mc2 is a child of mc1. Turns out that when I set mc1.visible = false; mc2.visible stays true. Is that supposed to happen?...

热门标签